my question is very simple, i am trying to make my 2d character jump on the y axis but when i try to run the game it says “Assets/jump.js(7,24): BCE0020: An instance of type ‘UnityEngine.Rigidbody’ is required to access non static member ‘velocity’.” i have a rigidbody on my character. do i need to assign a rigidbody in the script? or is it completely different?
my script is very simple, just;
var jump : int = 5;
function Update () {
if(Input.GetKeyUp("up"))
{
Rigidbody.velocity = Vector3(0, 5, 0);
}
}
By the way, use KeyCode enums rather than strings.
– Eric5h5so you have probably figured im new to this and still learning the bare basics lol. how do i fix this error?
– onionman99Well, I already said...rigidbody rather than Rigidbody.
– Eric5h5yea i tried that now it does nothing with no error... i should just give up now....
– onionman99ok i made a new scene and i worked on that character but not in the scene i want it to... :/ i dont think i was ever intended to be a game maker...
– onionman99