protected void DrawBuildButton(string buttonText = "Build")
 {
     if (GUI.Button(EditorGUILayout.GetControlRect(), buttonText) == true)
     {
         IBuildSetting setting = target as IBuildSetting;
         if (setting != null)
         {
             BuildPlayersResult results = setting.Build();
             Debug.Log(results);
         }
     }
 }
Esempio n. 2
0
        protected void DrawButtons(Rect rect, UnityEngine.Object serializedObject)
        {
            // Unindent
            bool originalEnabled = GUI.enabled;

            rect.x     -= EditorUiUtility.IndentSpace;
            rect.width += EditorUiUtility.IndentSpace;

            // Update enabled stuff
            IBuildSetting setting = serializedObject as IBuildSetting;

            GUI.enabled = (setting != null);

            // Draw Edit Button
            rect.width -= (EditorUiUtility.VerticalMargin * 2);
            rect.width /= 3f;
            if (GUI.Button(rect, "Edit") == true)
            {
                // Select object
                Selection.activeObject = serializedObject;
            }

            // Draw Duplicate Button
            rect.x += EditorUiUtility.VerticalMargin;
            rect.x += rect.width;
            if (GUI.Button(rect, "Duplicate") == true)
            {
                // Duplicate object
                Duplicate(serializedObject.name + " (Clone)", serializedObject);
            }

            // Draw build button
            rect.x += EditorUiUtility.VerticalMargin;
            rect.x += rect.width;
            if (GUI.Button(rect, "Build") == true)
            {
                // Make a build
                Debug.Log(setting.Build());
            }
            GUI.enabled = originalEnabled;
        }