What happened to "rigidbody" ?

Hey for some reason typing in rigidbody in C# won’t work? I can’t get rigidbody.AddForce() ?

you need to use get component now.

you have to initialise the reference yourself,

Rigidbody rigidbody = GetComponent<Rigidbody>();

In unity 5.0 and Above you can’t use rigidbody directly. you have to retrieve component from that object and then you can apply all the properties on that.
you should try.

  • Vector3 force=new Vector3(1,1,1);
  • GetComponent().AddForce(force);

Context example, for clarity.

usingUnityEngine;
usingSystem.Collections;

public class addForceExample : MonoBehaviour
{
     Rigidbody rig;
     public float speed = 10;

     void Start () 
     {
          rig = GetComponent<Rigidbody>();
     }

     void FixedUpdate () 
     {
          rig.AddForce(transform.forward * speed);
     }
}