我是Unity新手。当我按时,打印不起作用。
我已将脚本附加到角色上。
我在做什么错了?
using UnityEngine;
public class Player : MonoBehaviour
{
public Animator Anim;
void Start()
{
Anim = GetComponent<Animator>();
}
void Update()
{
if (Input.GetKeyDown("1"))
{
print("I pressed 1");
}
}
}
谢谢。
答案 0 :(得分:1)
请改用Debug.Log(“我按1”)
或
if (Input.GetKeyDown(KeyCode.Space)) { Debug.Log("Space key was pressed."); }