On Trigger Start / Stay / Exit | 2023 Beginner's Unity Tutorial
SS Gaming Unity 3D SS Gaming Unity 3D
1.21K subscribers
46 views
9

 Published On Sep 22, 2023

In this video, we learn how to use the infamous OnTrigger callback from unity. OnTriggerStart, OnTriggerStay and OnTriggerExit

OnTriggerEnter: This function is called when a GameObject with a collider enters the trigger collider of another GameObject. A trigger collider is a special type of collider that doesn't produce a physical collision response but is used to detect when objects enter or exit a specific area. You can use this function to perform actions when a collision occurs, such as triggering events, changing game state, or applying effects.

OnTriggerExit: This function is called when a GameObject with a collider exits the trigger collider of another GameObject. It's the opposite of OnTriggerEnter and can be used to perform actions when an object leaves a trigger area.

OnTriggerStay: This function is called every frame while a GameObject with a collider is inside the trigger collider of another GameObject. It's useful when you want to continuously perform actions as long as the objects are in contact with each other, such as applying damage over time or updating a score.

show more

Share/Embed