From f03a563fecb4dbc362fdff34b5678d9a8a3fe547 Mon Sep 17 00:00:00 2001 From: Trevlouw Date: Tue, 1 Apr 2025 20:01:31 -0400 Subject: [PATCH] Fix AnimationCurveExtensions --- EXILED/Exiled.API/Extensions/CommonExtensions.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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; } }