No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DestroyOnTrigger.cs 434B

123456789101112131415161718
  1. using UnityEngine;
  2. namespace Unity.AI.Navigation.Samples
  3. {
  4. /// <summary>
  5. /// Destroy owning GameObject if any collider with a specific tag is trespassing
  6. /// </summary>
  7. public class DestroyOnTrigger : MonoBehaviour
  8. {
  9. public string m_Tag = "Player";
  10. void OnTriggerEnter(Collider other)
  11. {
  12. if (other.gameObject.tag == m_Tag)
  13. Destroy(gameObject);
  14. }
  15. }
  16. }