Print / Debug.log在Unity控制台中不显示输出

时间:2020-10-29 20:57:37

标签: unity3d

我是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");
        }
    }
}

谢谢。

1 个答案:

答案 0 :(得分:1)

请改用Debug.Log(“我按1”)

if (Input.GetKeyDown(KeyCode.Space)) { Debug.Log("Space key was pressed."); }