From f246d68aa70ca2a5127b2b69e73b572a6a3dea9b Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 4 Aug 2025 14:56:43 +0300 Subject: [PATCH] fix: remove behaviour not starting the reverse for loop from count - 1 --- Engine.Core/BehaviourController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;