using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class CollisionDetector : MonoBehaviour { public List tagsToDetect; public Action OnEnter; public Action OnExit; private void OnTriggerEnter(Collider other) { if(tagsToDetect.Contains(other.tag) || tagsToDetect.Count == 0) { OnEnter?.Invoke(other); } } private void OnTriggerExit(Collider other) { if(tagsToDetect.Contains(other.tag) || tagsToDetect.Count == 0) { OnExit?.Invoke(other); } } }