This commit is contained in:
NotAKidoS 2023-03-24 19:50:57 -05:00
parent 7b5ad71060
commit 9cc62a961c
2 changed files with 28 additions and 29 deletions

View file

@ -1,8 +1,8 @@
using ABI.CCK.Components;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using HarmonyLib;
using UnityEngine;
using ABI_RC.Core.Player;
namespace NAK.Melons.BadAnimatorFix.HarmonyPatches;
@ -54,9 +54,10 @@ internal static class AnimatorPatches
Animator[] animators = gameObject.GetComponentsInChildren<Animator>(true);
foreach (Animator animator in animators)
{
if (animator.gameObject.GetComponent<BadAnimatorFix>() != null) continue;
if (animator.runtimeAnimatorController != null)
if (!animator.TryGetComponent<BadAnimatorFix>(out _))
{
animator.gameObject.AddComponent<BadAnimatorFix>();
}
}
}
}