Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Collider interactions

How collisions can call events and functions to trigger changes at run time.
Read time 1 minuteLast updated 18 days ago

When two colliders make contact, you can call functions to trigger other events in your project via scripting.
The two essential function types for collision interaction are
OnCollision
and
OnTrigger
.

Topic

Description

Use collisions to trigger other eventsOverview of collision events and triggers, and the scripting API you need to use.
Interaction between collider typesHow the different collider types interact with each other to call
OnCollision
and
OnTrigger
events.
OnCollision eventsHow colliders can call events when they physically collide.
OnTrigger eventsHow colliders can call events when one enters the space of another in a non-physical collision.
Create and configure a trigger colliderCreate a trigger collider and configure its associated GameObject to correctly call events on trigger interactions.
Example scripts for collider eventsExample scripts for
OnCollision
and
OnTrigger
events. These example scripts demonstrate some potential uses for scripted collision interactions and events.