Hello Unikron,Our team is doing packed images and Use scripts to automate generate sprite Animation script but not success
Here is my script
[MenuItem("Game/AutoCreate Sprite Animation")]
public static void CreateSpriteAnimaTest()
{
//sprite animation
string animaSpPath = "Assets/Actor/ActorAnimation.prefab";
tk2dSpriteAnimation newSpriteAnimation = null;//
if (animaSpPath.Length != 0)
{
GameObject go = new GameObject();
newSpriteAnimation = go.AddComponent<tk2dSpriteAnimation>();
tk2dEditorUtility.SetGameObjectActive(go, false);
UnityEngine.Object p = PrefabUtility.CreateEmptyPrefab(animaSpPath);
PrefabUtility.ReplacePrefab(go, p, ReplacePrefabOptions.ConnectToPrefab);
//GameObject.DestroyImmediate(go);
tk2dEditorUtility.GetOrCreateIndex().AddSpriteAnimation(AssetDatabase.LoadAssetAtPath(animaSpPath, typeof(tk2dSpriteAnimation)) as tk2dSpriteAnimation);
tk2dEditorUtility.CommitIndex();
//AnimationEditorPopup
tk2dSpriteAnimationEditorPopup editor = EditorWindow.GetWindow(typeof(tk2dSpriteAnimationEditorPopup), false, "Sprite Animation") as tk2dSpriteAnimationEditorPopup;
editor.CreateNewClip();
CBase.Log("new clip");
editor.SetSpriteAnimation(newSpriteAnimation);
//AutoFillFrames.
editor.Commit();
editor.Close();
}
}
However, the script did not like my expectations, it also creates SpriteAnimation, but SpriteAnimation is empty, Does not contain any NewClip,
ask for help