My script lets the user change the RuntimeAnimatorController of an Animator Component at runtime and I would like to let the user change the WrapMode (Loop, Once, Clamp, …) for every containing animation as well.
I’ve already tried to loop through all animation clips of the runtimeAnimatorController from the Animator Component and set their WrapMode but it doesn’t take effect at runtime (everything else works).
_animator.enabled = true;
_animator.runtimeAnimatorController = (RuntimeAnimatorController)setController;
AnimationClip[] _anims = _animator.runtimeAnimatorController.animationClips;
int i = 0;
foreach(var _anim in _anims)
{
_animator.runtimeAnimatorController.animationClips*.wrapMode = _wrapMode;*
i++;
}
(I know I could use a for-loop but I don’t know how to get the amount of AnimationStates either :P)
When searching for a solution I could only find something like ‘GetCurrentAnimatorStateInfo’, but that won’t return the Animation States to further work with.