Any way to set AnimatorOverrideController's animation clips programatically?
Basically, what I got:
Base animator controller that covers all animation states possibly needed for game characters.
Character specific animator controller exported from Spine.
I need to create AnimatorOverrideController
that overrides every single animation clip from base animator controller with character specific animation clips. Sure, it's possible to create override controller and drag&drop animation clips manually, but since there are 100+ clips in base controller it's just too easy to mess things up, not to mention it's time consuming. I made a tool to do so, but setting animation clips to AnimatorOverrideController.clips[].overrideClip
doesn't seem to change anything. Feels like I'm missing something completely. Any ideas on how to achieve desired result (which is: select AnimatorController exported from Spine > press the magic button > have an "all set up" AnimatorOverrideController
created in the same folder)? Thanks in advance.
Answer by Junglej0hn · Nov 14, 2016 at 09:15 AM
I am not completely sure exactly what you want to achieve, but to change an animation clip through an animator override controller in runtime, you can write:
myAnimatorOverrideCtrl["myAnimation"] = myAnimationClip;
"myAnimation" is the name of the animation that should be changed. This animation will be changed in all animation states where it is present.
hope this helps.