暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }