Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow AnimatorOverrideController to be used with the AnimatorParam attribute #321

Open
wants to merge 1 commit into
base: upm
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down