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

Script language

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

MonoBehaviour.OnTriggerExit(Collider)

Suggest a change

Success!

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 Collider involved in this collision.

Description

OnTriggerExit는 Collider가 /other/의 트리거에 닿는 것을 중지했을 때 호출됩니다.

이 메시지는 트리거 및 트리거가 닿은 콜라이더에 전송됩니다. Notes: Trigger events are only sent if one of the colliders also has a rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

	// Destroy everything that leaves the trigger

function OnTriggerExit (other : Collider) { Destroy(other.gameObject); }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnTriggerExit(Collider other) { Destroy(other.gameObject); } }

OnTriggerExit 은 함수안에 간단히 yield 구문을 사용해서 co-routine으로 실행할 수 있습니다.