如题,Event.current获取出来为NULL,然而获取当前输入的keyCode我需要获取到Evert.current。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
private Animator animator;//玩家的动画
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
Move();
}
void Move()
{
if (!animator.GetBool("OnMoving") && Input.anyKey)
{
Debug.Log(Event.current);
if (Input.anyKeyDown)
{
Event e = Event.current;
if (e.isKey)
{
Debug.Log("Current Key is : " + Event.current.keyCode.ToString());
}
}
}
}
}