using UnityEngine; public class WaterPlant : MonoBehaviour { public enum PlantType { LOTUS = 0, SEAWEED = 1, COUNT = 2 } public PlantType plantType = PlantType.COUNT; [HideInInspector] public BoxCollider boxCollider; public Fish occupyingFish; private void Awake() { boxCollider = GetComponent(); } private void OnTriggerEnter(Collider col) { if (col.gameObject.HasTag("FISH")) { Fish component = col.gameObject.GetComponent(); } } private void OnTriggerExit(Collider col) { if (col.gameObject.HasTag("FISH")) { Fish component = col.gameObject.GetComponent(); } } }