Null Reference Exceptions
Important Classes
This section provides an overview of some of the most commonly used and important built-in classes in Unity that you may want to use when scripting.
These pages serve as a starting point for the discovery of scripting basics in Unity, and do not cover all classes in Unity, or even every member of the classes which are covered.
For a more complete reference of all the built-in classes and every member available, see the Script Reference.
- GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary: Represents the type of objects which can exist in a SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary.
-
MonoBehaviour: The base class from which every Unity script derives, by default.
-
Object: The base class for all objects that Unity can reference in the editor.
-
Transform: Provides you with a variety of ways to work with a GameObject’s position, rotation and scale via script, as well as its hierarchical relationship to parent and child GameObjects.
-
Vectors: Classes for expressing and manipulating 2D, 3D, and 4D points, lines and directions.
- QuaternionUnity’s standard way of representing rotations as data. When writing code that deals with rotations, you should usually use the Quaternion class and its methods. More info
See in Glossary: A class which represents an absolute or relative rotation, and provides methods for creating and manipulating them.
-
ScriptableObject: A data container that you can use to save large amounts of data.
-
Time (and framerate management): The Time class allows you to measure and control time, and manage the framerate of your project.
-
Mathf: A collection of common math functions, including trigonometric, logarithmic, and other functions commonly required in games and app development.
-
Random: Provides you with easy ways of generating various commonly required types of random values.
-
Debug: Allows you to visualise information in the Editor that may help you understand or investigate what is going on in your project while it is running.
-
Gizmos and Handles: allows you to draw lines and shapes in the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary and Game view, as well as interactive handles and controls.
Null Reference Exceptions