hi
Is there way somehow change ModelImporter.clipAnimations from script (delete/insert/change elements) ?
hi
Is there way somehow change ModelImporter.clipAnimations from script (delete/insert/change elements) ?
I think you should be able to do this by assigning elements in the array. Are you finding this doesn’t work?
it does not work on ModelImporter.clipAnimations
cannot change existing aray element
do not know how to add new alement
Hi ironhero,
You can’t do this: "modelImporter.clipAnimations = obj;" because modelImporter.clipAnimations returns a copy of the array, so you’re modifying your local copy.
What you should do is create a new array, fill it with your data and then assign it to modelImporter.clipAnimations.
And don’t forget to read this thread (it another guy dealing with similar issues):
http://forum.unity3d.com/viewtopic.php?t=53351
thank you much, Paulius
will check it shortly
yes, it works
here is sample code
using UnityEngine;
using UnityEditor;
using System.Collections;
public class MyPostProcessor : AssetPostprocessor
{
void OnPostprocessModel (GameObject go )
{
if (!assetImporter) return;
ModelImporter mi = assetImporter as ModelImporter;
if (!mi) return;
ModelImporterClipAnimation[] anim = new ModelImporterClipAnimation [1];
anim[0] = new ModelImporterClipAnimation();
anim[0].name = "test1";
anim[0].firstFrame = 10;
anim[0].lastFrame = 20;
mi.clipAnimations = anim;
}
}