Join Kelley Hecker for an in-depth discussion in this video Understanding the MonoBehaviour game loop, part of Scripting Unity with C#.
- Different MonoBehaviour functions are called…at certain times during your games execution.…As you can see, there are a lot of…events called on MonoBehaviours.…I encourage you to look at the Unity Documentation…to find the events most suited for what…you're trying to achieve.…I'll be talking about the three most used functions.…Awake, Start, and Update.…Awake is called once, when the scene is first loaded,…before start or update.…Awake is a good place to initialize variables…that this script or other scripts will…try to access in Start.…
This is because you can't guarantee that one script's…start Start function will be called before another's.…If you initialized a variable in Start,…there's a chance that it may not have been created yet…when the other script tries to access it,…resulting in an error.…Speaking of Start.…Start is called once,…after Awake and before the first Update call.…Since Start is only called once per object,…and is called before Update,…it's a good place to set up any references you need.…Anything that only needs to happen once,…
- Defining classes and variables
- Attaching scripts to objects
- Understanding MonoBehaviour class
- Using the Unity Scripting API
- Importing assets
- Using a singleton pattern to manage game state
- Creating an event
Skill Level Intermediate
Advanced Unity 3D Game Programmingwith Michael House3h 45m Advanced
Creating Mobile Games with Unitywith Kelley Hecker1h 12m Intermediate
1. Your First Script
3. Built-In Unity Classes
Picking up coins4m 8s
5. Events and Delegates
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.