void OnDisable() { swarmRatBehavior = FindObjectOfType <SwarmBehaviorData>(); if (this.gameObject != null && swarmRatBehavior != null) { swarmRatBehavior.RemoveObserver(this); } }
public void DestroyObserver() { swarmRatBehavior.RemoveObserver(this); ObjectPooler.instance.ReturnObjectToPool("Bat", gameObject); }