ドキュメント

Unity Engine


User Manual

Script Reference

Unity Engine


Use collisions to trigger other events

Overview of collision events and triggers, and the scripting API you need to use.
読み終わるまでの所要時間 1 分最終更新 23日前

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.