MidiAnimImporter
MidiAnimImporter copied to clipboard
How change imported AnimationClip wrap mode?
I'd like the imported animations to loop. There is no default GUI for animation with wrap mode selection, so this needs to be done inside the importer script.
I've tried to set wrapMode in MidiAnimImporter class:
var anim = clip.ConvertToAnimationClip();
anim.wrapMode = WrapMode.Loop; // <--- set wrap mode
context.AddObjectToAsset("MIDI", anim);
context.SetMainObject(anim);
But it's still not looping. The animation clip is running via animator with a single entry -> clip logic.
What else is missing to have the clip looping?
So far I'm using a workaround: add the midi animation clip twice inside an animator and connect them with bi-directional transition.