fix: remove behaviour not starting the reverse for loop from count - 1

This commit is contained in:
Syntriax 2025-08-04 14:56:43 +03:00
parent 6e87c67096
commit f246d68aa7

View File

@ -72,7 +72,7 @@ public class BehaviourController : BaseEntity, IBehaviourController
public void RemoveBehaviour<T>(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;