MidiAnimImporter icon indicating copy to clipboard operation
MidiAnimImporter copied to clipboard

How change imported AnimationClip wrap mode?

Open marcinbiegun opened this issue 7 years ago • 1 comments

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?

marcinbiegun avatar May 24 '18 10:05 marcinbiegun

So far I'm using a workaround: add the midi animation clip twice inside an animator and connect them with bi-directional transition.

marcinbiegun avatar May 24 '18 15:05 marcinbiegun