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 scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info See in Glossary, 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 componentA Transform component determines the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform. More info See in Glossary 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. |
RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info See in Glossary / Rigidbody2D |
For most gameplay elements, the physics engineA system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info See in Glossary provides the easiest set of tools for moving objects around, detecting triggers and collisionsA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a rigidbody component and is in motion. More info See in Glossary, 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: