fix: BehaviourCollector Skipping Unregistered GameObjects

This commit is contained in:
Syntriax 2024-10-05 23:08:44 +03:00
parent 923b25e26e
commit fb402acc30
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,9 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
{
gameObject.BehaviourController.OnBehaviourAdded -= OnBehaviourAdded;
gameObject.BehaviourController.OnBehaviourRemoved -= OnBehaviourRemoved;
foreach (IBehaviour item in gameObject.BehaviourController)
OnBehaviourRemoved(gameObject.BehaviourController, item);
}
private void OnBehaviourAdded(IBehaviourController controller, IBehaviour behaviour)