Trigger2D Functions

There are a handful of events that can be raised by any Collider 2D Component in Unity. The event functions, and the circumstances in which they are triggered, are as follows:

Image OnTriggerEnter2D(): Raised when an object first enters a trigger collider attached to this GameObject

Image OnTriggerExit2D(): Raised when an object exits a trigger collider attached to this GameObject

Image OnTriggerStay2D(): Raised each frame that an object is within ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.