Version: 2023.2
Physic Material asset reference
Use collisions to trigger other events

Collider interactions

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 描述
Use collisions to trigger other events Overview of collision events and triggers, and the scripting API you need to use.
OnCollision events How colliders can call events when they physically collide.
OnTrigger events How colliders can call events when one enters the space of another in a non-physical collision.
Create and configure a trigger collider Create a trigger collider and configure its associated GameObject to correctly call events on trigger interactions.
Example scripts for collider events Example scripts for OnCollision and OnTrigger events. These example scripts demonstrate some potential uses for scripted collision interactions and events.
Physic Material asset reference
Use collisions to trigger other events