Get ShaderGraph EditorWindow

Home   »   Get ShaderGraph EditorWindow

private void OnGUI()
{
    if (GUILayout.Button("Test"))
    {
        Assembly targetAssembly = Assembly.Load("Unity.ShaderGraph.Editor");
        Type type = targetAssembly.GetType("UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow", true);
        Object[] objects = Resources.FindObjectsOfTypeAll(type);
        foreach (EditorWindow shaderGraphWindow in objects)
        {
            Debug.Log(shaderGraphWindow.titleContent.text + ", " + shaderGraphWindow.rootVisualElement);
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *