Quantcast
Channel: Latest Questions by gstock
Viewing all articles
Browse latest Browse all 4

Change AnimationClip settings during import

0
0
I have a group of animations that need to have the LoopTime set to True (Idle, Walk, Run). I would like to set this setting during import time using an AssetPostprocessor. I've already tried using OnPreprocessModel and OnPostprocessModel but haven't had luck with them. Basically I noticed that I could do: ModelImporter modelImporter = assetImporter as ModelImporter; and access modelImporter.clipAnimations, but this array is always empty. I managed to populate it using ModelImporterClipAnimation clipAnimation = new ModelImporterClipAnimation(); clipAnimation.firstFrame = [FIRST_FRAME] clipAnimation.lastFrame = [LAST_FRAME] clipAnimation.name = [ANIM_NAME] clipAnimation.loopTime = true; ModelImporterClipAnimation[] clips = new ModelImporterClipAnimation[1]; clips[0] = clipAnimation modelImporter.clipAnimations = clips; But I cannot find a way to get the values for [FIRST_FRAME], [LAST_FRAME] and [ANIM_NAME]. I'm using just one animation per FBX, so basically the length of the clip gets detected by Unity automatically

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images