Join Kelley Hecker for an in-depth discussion in this video Other MonoBehaviour event receivers, part of Scripting Unity with C#.
- If we look back at the MonoBehavioural…life cycle graph, we can see that there…are many events that are sent to MonoBehaviours…besides Awake, Start, and Update.…I'll go over a few of the ones you're most likely to use.…OnEnable and OnDisable are called when the script…is enabled or disabled.…Disabling a script only stops the Awake, Start,…and Update functions from being called.…So if you have InvokeRepeating or coroutines running…you may want to stop them in OnDisable…and restart them on OnEnable.…
OnCollisionEnter, OnCollisionStay, and OnCollisionExit…are called when a rigid body collides with something.…This event passes the colliding object as an argument.…OnTriggerEnter, OnTriggerStay, and OnTriggerExit…are essentially the same as OnCollision events…except that they work for triggers instead of colliders.…A trigger isn't affected by the physics system…and is used for things like determining…when an object enters an area.…Colliders that enter a trigger will pass right through.…While you'll use Update most of the time,…
- 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?
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.