unity rigidbody2d code example Example 1: how to add reference to rigidbody 2d public Rigidbody2D rb; Example 2: unity rigidbody private Rigidbody rigidbody