diff --git a/Engine.Core/BehaviourController.cs b/Engine.Core/BehaviourController.cs index 9334871..7da0e27 100644 --- a/Engine.Core/BehaviourController.cs +++ b/Engine.Core/BehaviourController.cs @@ -72,7 +72,7 @@ public class BehaviourController : BaseEntity, IBehaviourController public void RemoveBehaviour(bool removeAll = false) where T : class, IBehaviour { - for (int i = behaviours.Count; i >= 0; i--) + for (int i = behaviours.Count - 1; i >= 0; i--) { if (behaviours[i] is not T behaviour) continue;