コード例 #1
0
    // Draw the CloudsToy Icon (it's a button that opens the CloudsToy info window!!!!)
    private void DrawCloudsToyIcon()
    {
        EditorGUILayout.BeginVertical();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        GUIContent GUIContentTexture = new GUIContent(myCloudsToyIcon, "CloudsToy rocks!");
        GUIStyle   newGUIStyle       = new GUIStyle(GUI.skin.label)
        {
            alignment = TextAnchor.MiddleCenter
        };

        Rect iconRect = EditorGUILayout.BeginHorizontal();

        iconRect.x      = iconRect.width / 4f;
        iconRect.width /= 2;
        iconRect.height = iconRect.width / 2;
        // Pressing the CloudsToy Icon will oepn a CloudsToy information window.
        if (GUILayout.Button(GUIContentTexture, newGUIStyle))
        {
            CloudsToyWindow.OpenCloudsToyWindow();
        }

        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();
    }
コード例 #2
0
    public static void OpenCloudsToyWindow()
    {
        CloudsToyWindow window = GetWindow <CloudsToyWindow>();

        window.titleContent             = new GUIContent("CloudsToy");
        window.titleContent.image       = EditorGUIUtility.IconContent("_Help").image;
        window.autoRepaintOnSceneChange = true;
        window.maxSize = new Vector2(windowWidth, windowHeight);
        window.minSize = new Vector2(windowWidth, windowHeight);
        window.Show();
        window.Focus();
    }