Skip to content

Commit 8aaf227

Browse files
committed
Add legacy animation creator
1 parent f1a9afa commit 8aaf227

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

Assets/Scripts/Editor/Animation.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Editor/Animation/LegacyAnimationCreator.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.IO;
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
public class LegacyAnimationCreator
6+
{
7+
[MenuItem("Assets/Create/Legacy Animation", priority = 402)]
8+
public static void CompressSelectedAnimationClips()
9+
{
10+
var clip = new AnimationClip();
11+
clip.legacy = true;
12+
clip.name = "New Legacy Animation";
13+
14+
string path;
15+
var selection = Selection.activeObject;
16+
if (selection == null)
17+
path = "Assets";
18+
else
19+
path = AssetDatabase.GetAssetPath(selection.GetInstanceID());
20+
21+
path = Path.GetDirectoryName(path);
22+
path += $"/{clip.name}.anim";
23+
24+
ProjectWindowUtil.CreateAsset(clip, path);
25+
Selection.activeObject = clip;
26+
EditorUtility.SetDirty(clip);
27+
}
28+
}

Assets/Scripts/Editor/Animation/LegacyAnimationCreator/LegacyAnimationCreator.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)