Unity runtime applications run in a loop, where the engine repeatedly processes input, updates game state, and renders frames. This is commonly called the game or Player loop. Traditional component-based Unity projects use MonoBehaviour script componentsA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary to hook into the Player loop through a series of built-in callbacks called event functions, which provide the opportunity to update your GameObjectsThe 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 every frame, or in response to specific events.
Knowing the execution order can help you with customization and optimization of Unity projects. For example, you might need to ensure some setup work always happens before the first frame update, or that 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 controlling the engine of a vehicle always run before those that control its steering.
Topic | Description |
---|---|
Script execution order | Understand how Unity prioritizes execution of individual MonoBehaviour scripts. |
Event function execution order | Understand the execution order of Unity’s built-in event functions so you can respond to events and update the state of your game in the right order. |
Customizing the Player loop | Customize the Player loop to change the order in which Unity updates systems in each iteration of the loop. |