c# gameobject add rigidbody code example
Example 1: unity rigidbody addforce
rb = GetComponent<Rigidbody>();
rb.AddForce(new Vector3(1.5f,1.5f,1.5f));
Example 2: how to add reference to rigidbody 2d
public Rigidbody2D rb;
rb = GetComponent<Rigidbody>();
rb.AddForce(new Vector3(1.5f,1.5f,1.5f));
public Rigidbody2D rb;