Version: 2023.2
言語: 日本語
Collider interactions
OnCollision events

Use collisions to trigger other events

When two colliders make contact, they call functions that you can use to trigger other events in your project. You can place any code you like in these functions to respond to the collision event.

Collider events require configuration via C# script; you cannot configure them using only the user interface.

There are two collider event types:

A collider that has Is Trigger enabled is called a trigger collider. Trigger colliders do not physically collide with other colliders; instead, they create a space that sends an event when other colliders pass through it.

Note: The 2D physics system has equivalent functions with 2D appended to the name (for example, OnCollisionEnter2D). For details of these 2D functions, refer to the MonoBehaviour API class documentation.

Collider interactions
OnCollision events