public bool onGround;
private Rigidbody rb;
// Use this for initialization
void Start ()
{
onGround = true;
rb = GetComponent<Rigidbody> ();
}
// Update is called once per frame
void update ()
{
if (onGround)
{
if (Input.GetKeyDown ("a"))
{
rb.velocity = new Vector3 (0f, 5f, 0f);
onGround = false;
}
}
}
}
答案 0 :(得分:1)
实际上,更新功能未正确设置的可能性更大
将其更改为
void Update()