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,7 +29,8 @@ public class BehaviourController : BaseEntity, IBehaviourController
behaviour.Assign(this);
behaviour.Assign(Factory.StateEnableFactory.Instantiate(behaviour));
behaviour.Initialize();
if (IsInitialized)
behaviour.Initialize();
behaviour.OnPriorityChanged += OnPriorityChange;
OnBehaviourAdded?.InvokeSafe(this, behaviour);
return behaviour;