Version: 2021.1
Null Reference Exceptions
Important Classes - GameObject

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)[ScriptRef:index.html].

  • GameObject: Represents the type of objects which can exist in a Scene.
  • 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.
  • Quaternion: 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 view and Game view, as well as interactive handles and controls.
Null Reference Exceptions
Important Classes - GameObject