I do not understand triggers!

Ok so I know I might sound stupid but I don’t have a strong grip on triggers if anyone can help that would be great thanks a lot.

Hello Ayman,

Do you mean from the perspective of colliders?

Yes so I dont understand how they work

Hi Ayman,

If we take a Rigidbody2D as an example…

When you set Is Trigger to true, objects with a RigidBody2D will no longer register a collision when they make contact, instead, they will travel through it. A message is sent and can be handled using methods such as OnTriggerEnter2D, OnTriggerStay2D, OnTriggerExit2D

The same is true in a 3D environment, where you would have a Rigidbody and use methods such as OnTriggerEnter, OnTriggerStay and OnTriggerExit.

They can be really useful for lots of different things, for example, perhaps if a player steps into that specific area an audio effect is played. Perhaps you use one as a range around an enemy to detect the player, representing their ability to “hear”.

You could think of them as a defined zone which notifies you when something enters it, leaves it, or is still in it.

Hope this helps :slight_smile:


See also;

1 Like

Thank you so much

1 Like

You are very welcome :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms