예제 #1
0
 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);
         }
     }
 }
예제 #2
0
        protected void DrawButtons(Rect rect, UnityEngine.Object serializedObject)
        {
            // Unindent
            bool originalEnabled = GUI.enabled;

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

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

            GUI.enabled = (setting != null);

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

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

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