Unity 5 is giving me compiler errors when I upgraded a project from Unity 4. It doesn’t want me to use the rigidbody2D function, and tells me to use GetComponent but I’m not sure exactly how to go about it.
How can I get these 2 obsolete lines of code to work in Unity 5?
rigidbody2D.velocity = new Vector2 (0f, 0f);
rigidbody2D.AddForce (force * new Vector2 (x, y));