diff --git a/EXILED/Exiled.API/Extensions/CommonExtensions.cs b/EXILED/Exiled.API/Extensions/CommonExtensions.cs index b4db94160a..6b175fc281 100644 --- a/EXILED/Exiled.API/Extensions/CommonExtensions.cs +++ b/EXILED/Exiled.API/Extensions/CommonExtensions.cs @@ -56,9 +56,11 @@ public static T GetRandomValue(this IEnumerable enumerable, System.FuncThe new modfied curve. public static AnimationCurve Multiply(this AnimationCurve curve, float amount) { - for (int i = 0; i < curve.length; i++) - curve.keys[i].value *= amount; + Keyframe[] keys = curve.keys; + for (int i = 0; i < keys.Length; i++) + keys[i].value *= amount; + curve.keys = keys; return curve; } @@ -70,9 +72,11 @@ public static AnimationCurve Multiply(this AnimationCurve curve, float amount) /// The new modfied curve. public static AnimationCurve Add(this AnimationCurve curve, float amount) { - for (int i = 0; i < curve.length; i++) - curve.keys[i].value += amount; + Keyframe[] keys = curve.keys; + for (int i = 0; i < keys.Length; i++) + keys[i].value += amount; + curve.keys = keys; return curve; } }