Created
November 27, 2018 17:28
-
-
Save GhatSmith/1c0720e53d0002accff55432568c7add to your computer and use it in GitHub Desktop.
Little script to open an additional Animator window in Unity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
namespace Framework.Core.EditorExtension | |
{ | |
public class OpenAdditionalAnimatorWindow : MonoBehaviour | |
{ | |
static EditorWindow window = null; | |
[MenuItem("Tools/Animations/Open Additional Animator Window &%a", false)] | |
static void CreateAdditionalAnimatorWindow() | |
{ | |
if (window == null) | |
{ | |
// Open additional animator window | |
window = (ScriptableObject.CreateInstance(GetAnimatorWindowType()) as EditorWindow); | |
window.Show(); | |
} | |
else | |
{ | |
// Close additional animator window | |
window.Close(); | |
DestroyImmediate(window); | |
window = null; | |
} | |
} | |
private static System.Type GetAnimatorWindowType() | |
{ | |
return (typeof(UnityEditor.Graphs.AnimationCurveTypeConverter).Assembly.GetType("UnityEditor.Graphs.AnimatorControllerTool")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment