Skip to content

Instantly share code, notes, and snippets.

@fumobox
Created September 12, 2019 05:05
Show Gist options
  • Save fumobox/f9446d682edbcaa3ac1c0561755437ce to your computer and use it in GitHub Desktop.
Save fumobox/f9446d682edbcaa3ac1c0561755437ce to your computer and use it in GitHub Desktop.
using UnityEditor;
using UnityEngine;
public static class AnimationConverter
{
[MenuItem("Assets/Animation/CopyAnimationClipAsLegacy", true)]
public static bool ValidateCopyAnimationClipAsLegacy()
{
return Selection.activeObject is AnimationClip;
}
[MenuItem("Assets/Animation/CopyAnimationClipAsLegacy", false)]
public static void CopyAnimationClipAsLegacy()
{
var clip = Selection.activeObject as AnimationClip;
var copy = Object.Instantiate(clip);
copy.legacy = true;
AssetDatabase.CreateAsset(copy, "Assets/" + clip.name + ".anim");
AssetDatabase.Refresh();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment