Similar Behavior as creating AnimationController at runtime without UnityEditor namespace

I’m creating a weapon system, each weapon will override player’s animations. The solution that I came up with was to instantiate AnimatorController, add states and put animations at appropriate states. Now that I tried to build it, I realized I can’t use UnityEditor namespaces for build.

I guess the alternative is to create OverrideAnimatorController(s) from editor and use that, but I’d hope that there was some way to just use AnimatorController instantiation instead? Why can’t we do it?

Thanks

edit: Fixed my issue by adopting the legacy animation system. I realized that I was already internally managing the states and animation clips for those states, I was only using AnimatorController because I wanted .CrossFade function. Turns out it’s also available in legacy Animation component.

Animator Controllers can’t be edited at runtime. You need to use Animator Override Controllers or a different animation system.

1 Like