/// <summary>
        /// from a given name, Open an EditorWindow.
        /// you can also do:
        /// EditorApplication.ExecuteMenuItem("Window/General/Hierarchy");
        /// to open an known EditorWindow
        ///
        /// To get the type of a known script, like UnityEditor.SceneHierarchyWindow, you can do also:
        /// System.Type type = typeof(EditorWindow).Assembly.GetType("UnityEditor.SceneHierarchyWindow");
        /// </summary>
        /// <param name="editorWindowName">name of the editorWindow to open</param>
        /// <param name="animationWindowType">type of the editorWindow (useful for others functions)</param>
        /// <returns></returns>
        public static EditorWindow OpenEditorWindow(AllNameAssemblyKnown editorWindowName, out System.Type animationWindowType)
        {
            animationWindowType = GetEditorWindowTypeByName(editorWindowName.ToString());
            EditorWindow animatorWindow = EditorWindow.GetWindow(animationWindowType);

            return(animatorWindow);
        }
Beispiel #2
0
    /*
     * /// <summary>
     * /// from a given name, return and open/show the editorWindow
     * /// usage:
     * /// System.Type animationWindowType = null;
     * /// EditorWindow animationWindowEditor = ExtReflexion.ShowAndReturnEditorWindow(ExtReflexion.AllNameAssemblyKnown.AnimationWindow, ref animationWindowType);
     * /// </summary>
     * public static EditorWindow ShowAndReturnEditorWindow(AllNameAssemblyKnown editorWindow, ref System.Type animationWindowType)
     * {
     *  System.Reflection.Assembly editorAssembly = System.Reflection.Assembly.GetAssembly(typeof(EditorWindow));
     *  animationWindowType = ExtReflexion.GetTypeFromAssembly(editorWindow.ToString(), editorAssembly);
     *  EditorWindow animationWindowEditor = EditorWindow.GetWindow(animationWindowType);
     *
     *  return (animationWindowEditor);
     * }
     */

    /*
     * meth_PickObjectMeth = type_HandleUtility.GetMethod("myFunction",
     *                                       BindingFlags.Static | BindingFlags.Public, //if static AND public
     *                                       null,
     *                                       new [] {typeof(Vector2), typeof(bool)},//specify arguments to tell reflection which variant to look for
     *                                       null)
     */

    private static EditorWindow ShowAndReturnEditorWindow(AllNameAssemblyKnown editorWindow, ref System.Type animationWindowType)
    {
        animationWindowType = GetEditorWindowTypeByName(editorWindow.ToString());
        EditorWindow animatorWindow = EditorWindow.GetWindow(animationWindowType);

        return(animatorWindow);
    }