These are some of the most important classes you’ll be using when scripting with Unity. They cover some of the core areas of Unity’s scriptable systems and provide a good starting point for looking up which functions and events are available.
Class: | Description: |
---|---|
MonoBehaviour | The base class for all new Unity scripts, the MonoBehaviour reference provides you with a list of all the functions and events that are available to standard scripts attached to Game Objects. Start here if you’re looking for any kind of interaction or control over individual objects in your game. |
Transform | Every Game Object has a position, rotation and scale in space (whether 3D or 2D), and this is represented by the Transform component. As well as providing this information, the transform component has many helpful functions which can be used to move, scale, rotate, reparent and manipulate objects, as well as converting coordinates from one space to another. |
Rigidbody / Rigidbody2D | For most gameplay elements, the physics engine provides the easiest set of tools for moving objects around, detecting triggers and collisions, and applying forces. The Rigidbody class (or its 2D equivalent, Rigidbody2D) provides all the properties and functions you’ll need to play with velocity, mass, drag, force, torque, collision and more. |
Did you find this page useful? Please give it a rating: