- Home /
Question by
HiteshSharma · May 05, 2017 at 01:15 PM ·
animationunity 5animatoranimator controlleroverride
Cannot cast RuntimeAnimatorController to AnimatorOverrideController
I want to use AnimatorOverrideController to change the animation at run time through script. I tried this which gives and InvalidCastException:
RuntimeAnimatorController controller = animator.runtimeAnimatorController;
AnimatorOverrideController overrideController = (AnimatorOverrideController)controller;
And this makes controller to null
RuntimeAnimatorController controller = animator.runtimeAnimatorController;
AnimatorOverrideController overrideController = controller as AnimatorOverrideController;
That's what i found in all the code samples everywhere. Not sure what is going wrong here. I am using Unity 5.5
Comment
Your answer
Follow this Question
Related Questions
Preview overridden and ovverriding animation at once 0 Answers
How to trigger the same animator state in unity5 with script? 2 Answers
Can animation clips be swapped out of the animator override controller in runtime? 1 Answer
Animation Different in Unity 5 1 Answer
Check Animator State Animation Completed 0 Answers