other | The other Collider involved in this collision. |
OnTriggerExit вызывается, когда Collider other
перестает соприкасаться с триггером.
Это сообщение отправляется триггеру и коллайдеру, который соприкасается с триггером. Обратите внимание, что события о триггерах присылаются только если один из коллайдеров так-же имеет присоединенный rigidbody. OnTriggerExit occurs on the FixedUpdate after the Colliders have stopped touching. The Colliders involved are not guaranteed to be at the point of initial separation.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void OnTriggerExit(Collider other) { // Destroy everything that leaves the trigger Destroy(other.gameObject); } }