From 2215daa0d2a49067aeed40e95965872f9e631e8e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Fortier Date: Wed, 1 Jun 2022 14:39:54 -0400 Subject: [PATCH] feat: allow AnimatorOverrideController to be used with the AnimatorParam attribute --- .../AnimatorParamPropertyDrawer.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs b/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs index 080b1bc8..0320d5cb 100644 --- a/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs +++ b/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs @@ -138,6 +138,13 @@ private static AnimatorController GetAnimatorController(SerializedProperty prope if (animator != null) { AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + + // [PATCH] Allow AnimatorOverrideController to be used with the AnimatorParam attribute. + if (!animatorController && animator.runtimeAnimatorController is AnimatorOverrideController animatorOverrideController) + { + animatorController = animatorOverrideController.runtimeAnimatorController as AnimatorController; + } + return animatorController; } } @@ -150,6 +157,13 @@ private static AnimatorController GetAnimatorController(SerializedProperty prope if (animator != null) { AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + + // [PATCH] Allow AnimatorOverrideController to be used with the AnimatorParam attribute. + if (!animatorController && animator.runtimeAnimatorController is AnimatorOverrideController animatorOverrideController) + { + animatorController = animatorOverrideController.runtimeAnimatorController as AnimatorController; + } + return animatorController; } } @@ -163,6 +177,13 @@ private static AnimatorController GetAnimatorController(SerializedProperty prope if (animator != null) { AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + + // [PATCH] Allow AnimatorOverrideController to be used with the AnimatorParam attribute. + if (!animatorController && animator.runtimeAnimatorController is AnimatorOverrideController animatorOverrideController) + { + animatorController = animatorOverrideController.runtimeAnimatorController as AnimatorController; + } + return animatorController; } }