Hi, I’m very new to unity and started programming in javascript.
This is probably a very dumb mistake but what I’m trying to do is to make the rigidbody attached to the cube move along the y axis when I click “W”.Instead when I press Start, It goes up straight away without me clicking “W”
Here is my code:
#pragma strict
var rb: Rigidbody;
function Start () {
rb = GetComponent.();
}
function FixedUpdate () {
if (Input.GetKeyDown(KeyCode.W));{
rb.velocity = Vector3(0,10,0);
}
}
Thank you in advance.