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