Hello!
In my game, I’m trying to get my player to jump, and in past games it’s worked, but for some reason now it just won’t do anything. I don’t get any errors, but whenever I press space, nothing happens. Why is this happening? Is it the version of Unity I’m using (5.4.1), or what? I tried looking at the script reference, but there's not even an example in Javascript.
Here’s my code, if that helps:
#pragma strict
public var jumpSpeed = 10;
function FixedUpdate()
{
if (Input.GetKey(KeyCode.Space))
{
GetComponent.().AddForce(new Vector3(0, jumpSpeed * Time.deltaTime, 0));
}
}
↧