fix: Behaviour Collector Not Recognizing Registered GameObjects After Initial Setup

This commit is contained in:
Syntriax 2024-10-22 21:46:26 +03:00
parent 1f8fa78b76
commit cf8a5de580
1 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,9 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
{ {
gameObject.BehaviourController.OnBehaviourAdded += OnBehaviourAdded; gameObject.BehaviourController.OnBehaviourAdded += OnBehaviourAdded;
gameObject.BehaviourController.OnBehaviourRemoved += OnBehaviourRemoved; gameObject.BehaviourController.OnBehaviourRemoved += OnBehaviourRemoved;
foreach (IBehaviour item in gameObject.BehaviourController)
OnBehaviourAdded(gameObject.BehaviourController, item);
} }
private void OnGameObjectUnregistered(IGameManager manager, IGameObject gameObject) private void OnGameObjectUnregistered(IGameManager manager, IGameObject gameObject)