fix: behaviour controller initializing added behaviours when it itself is not initialized

This commit is contained in:
Syntriax 2025-04-25 21:54:05 +03:00
parent 4623b4861a
commit c39ee44442

View File

@ -29,6 +29,7 @@ public class BehaviourController : BaseEntity, IBehaviourController
behaviour.Assign(this); behaviour.Assign(this);
behaviour.Assign(Factory.StateEnableFactory.Instantiate(behaviour)); behaviour.Assign(Factory.StateEnableFactory.Instantiate(behaviour));
if (IsInitialized)
behaviour.Initialize(); behaviour.Initialize();
behaviour.OnPriorityChanged += OnPriorityChange; behaviour.OnPriorityChanged += OnPriorityChange;
OnBehaviourAdded?.InvokeSafe(this, behaviour); OnBehaviourAdded?.InvokeSafe(this, behaviour);