Assets/GameContent/Motiontracks/Editor/AnimationImporter.cs(60,52): error CS0029: Cannot implicitly convert type UnityEditor.ModelImporterClipAnimation[]' to
UnityEditor.ModelImporterClipAnimation’
Once again I was trying to import animationsand apparently I can’t convert when I was trying to import a couple of animations.
Here’s the code:
ModelImporterClipAnimation clips = modelImporter.clipAnimations;
Object asset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject));
EditorUtility.SetDirty(asset);
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
}
}
private ModelImporterClipAnimation SetClipAnimationNew(string name, int firstFrame, int lastFrame, bool loop)
{
ModelImporterClipAnimation mica = new ModelImporterClipAnimation();
mica.name = name;
mica.firstFrame = firstFrame;
mica.lastFrame = lastFrame;
mica.loop = loop;
if (loop)
mica.wrapMode = WrapMode.Loop;
else
mica.wrapMode = WrapMode.Once;
return mica;
}
}