Version: 5.3 (switch to 5.4b)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



Switch to Manual


other The other Collider2D involved in this collision.


오브젝트에 연결된 트리거 안에 다른 오브젝트가 들어갔을 때 호출됩니다. (2D 물리만)

들어간 오브젝트에 대한 자세한 정보는 호출시 전달되는 Collision2D 인수로 보고됩니다.

주의: 트리거 이벤트들은 비활성화된 MonoBehaviour로 보내질 것입니다. 그 이유는 충돌에 대한 반응으로 Behaviour를 활성화시킬 수 있도록 하기 위해서 입니다.

See Also: Collider2D 클래스, OnTriggerExit2D, OnTriggerStay2D.

var characterInQuicksand: boolean;

function OnTriggerEnter2D(other: Collider2D) { characterInQuicksand = true; }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public bool characterInQuicksand; void OnTriggerEnter2D(Collider2D other) { characterInQuicksand = true; } }