other | The other Collider involved in this collision. |
OnTriggerExit is called when the Collider other
has stopped touching the trigger.
This message is sent to the trigger and the Collider that touches the trigger. Ten en cuenta que los eventos de colisión se envían sólo si al menos uno de los Colliders también tiene un Rigidbody no cinemático adjunto. 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); } }