I am making a 2D game and in the process of making a jumping script I noticed that I could use the “rigidbody2D.addforce” for it. When I began to test the code for errors, it said that “addforce” was not defined. Also, I am using unityscript for this.
“rigidbody2D.addforce” is not a method of type Rigidbody2D
If you have a type RigidBody2D:
var rb:Rigidbody2D = GetComponent.<Rigidbody2D>();
and you want to invoke the method “AddForce”, then case is explicit as shown in the link above.
you can now use the variable “rb” which is of type Rigidbody2D to invoke the method.
rb.AddForce(new Vector2(1, 2));
What your code, it is case sensitive.