fix: Duplicate Values on Behaviour Collector

This commit is contained in:
Syntriax 2024-11-03 20:31:51 +03:00
parent 55ed8b84f6
commit 85f0555c59
1 changed files with 0 additions and 8 deletions

View File

@ -68,11 +68,7 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
return false; return false;
foreach (IGameObject gameObject in gameManager) foreach (IGameObject gameObject in gameManager)
{
OnGameObjectRegistered(gameManager, gameObject); OnGameObjectRegistered(gameManager, gameObject);
foreach (IBehaviour behaviour in gameObject.BehaviourController)
OnBehaviourAdded(gameObject.BehaviourController, behaviour);
}
gameManager.OnGameObjectRegistered += OnGameObjectRegistered; gameManager.OnGameObjectRegistered += OnGameObjectRegistered;
gameManager.OnGameObjectUnRegistered += OnGameObjectUnregistered; gameManager.OnGameObjectUnRegistered += OnGameObjectUnregistered;
@ -89,11 +85,7 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
return false; return false;
foreach (IGameObject gameObject in GameManager) foreach (IGameObject gameObject in GameManager)
{
OnGameObjectUnregistered(GameManager, gameObject); OnGameObjectUnregistered(GameManager, gameObject);
foreach (IBehaviour behaviour in gameObject.BehaviourController)
OnBehaviourRemoved(gameObject.BehaviourController, behaviour);
}
GameManager.OnGameObjectRegistered -= OnGameObjectRegistered; GameManager.OnGameObjectRegistered -= OnGameObjectRegistered;
GameManager.OnGameObjectUnRegistered -= OnGameObjectUnregistered; GameManager.OnGameObjectUnRegistered -= OnGameObjectUnregistered;