I am doing the roll a ball tutorial for unity. When doing the scripting for it the script editor says it does not contain a definition for AddForce. What should I do to fix it ?
Thanks in advance
You should really add your script you have written so far here. Otherwise we do not know what’s your problem.
{
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement);
}
}
I believe that usage of rigidibody is deprecated. Set an instance of GetComponent() to a class field in the Awake() method and reference that field instead. Also keep an eye on your editor and the tooltips. Most IDEs will warn you if you try using an obsolete field or method. I don’t know what it is in MonoDevelop but it’s a green squiggly line in Visual Studio.