Unity lifecycle callback functions

Next Story

Unity click to move with navmesh and navmesh agent

If you create a unity project, you will most likely create a class that inherits from MonoBehaviour.

I’ll talk a bit about some of the most important MonoBehaviour methods since they will be driving a majority of game functionalities.

The most important methods will be: Start, Update, Awake and LateUpdate. You won’t need to use all of these callback functions with every c# class but these are the most common ones and you can view all of the functions in the documentation here.

Start

The Start function is called on the first frame that the script is active and loaded. The start function is a great place to write initialization code for your scene or your game object.

Update

The Update function is ran with every frame. This function is great for anything that needs to be done continuously in your level.

Awake

The Awake function is ran when a script becomes active. It is called right before start and is a great place to get references for components.

LateUpdate

The LateUpdate function is called after Update and is another great place to put physics related movement code.

So those were some of the most commonly used MonoBehaviour callback functions, have fun gaming!

Leave a Reply

Your email address will not be published. Required fields are marked *

https://www.googletagmanager.com/gtag/js?id=UA-63695651-4