private void OnGUI()
 {
     GUI.enabled = !UnityEditor.BuildPipeline.isBuildingPlayer;
     EditorGUILayout.LabelField("Folder name formatting", EditorStyles.boldLabel);
     using (var changeScope = new EditorGUI.ChangeCheckScope())
     {
         settings.nameFormat = EditorGUILayout.TextField(settings.nameFormat);
         if (changeScope.changed)
         {
             settings.Save();
         }
     }
     EditorGUILayout.HelpBox(HELPBOX_NAME_FORMATTING_INFO, MessageType.Info, true);
     EditorGUILayout.LabelField("Formatted name", settings.GetFolderName(), EditorStyles.helpBox);
     using (var changeScope = new EditorGUI.ChangeCheckScope())
     {
         settings.dateTimeFormat       = EditorGUILayout.TextField("Date time format", settings.dateTimeFormat);
         settings.stripMobileWarning   = EditorGUILayout.Toggle("Strip mobile warning", settings.stripMobileWarning);
         settings.fixMacOSVersionRegex = EditorGUILayout.Toggle("Fix Mac OS Version Regex", settings.fixMacOSVersionRegex);
         settings.createNewFolder      = EditorGUILayout.Toggle("Create new folder", settings.createNewFolder);
         settings.linkerTarget         = (WebGLLinkerTarget)EditorGUILayout.EnumPopup("Linker target", settings.linkerTarget);
         settings.memorySize           = EditorGUILayout.IntField("Memory size", settings.memorySize);
         settings.compressionFormat    = (WebGLCompressionFormat)EditorGUILayout.EnumPopup("Compression", settings.compressionFormat);
         settings.wasmStreaming        = EditorGUILayout.Toggle("WASM Streaming", settings.wasmStreaming);
         settings.buildOptions         = (BuildOptions)EditorGUILayout.EnumFlagsField("Build options", settings.buildOptions);
         string templateName = PlayerSettings.WebGL.template.Substring(PlayerSettings.WebGL.template.IndexOf(':') + 1);
         EditorGUILayout.LabelField("Template", templateName, EditorStyles.helpBox);
         if (changeScope.changed)
         {
             settings.Save();
         }
     }
     using (var verticalScope = new EditorGUILayout.VerticalScope())
     {
         using (var horizontalScope = new EditorGUILayout.HorizontalScope())
         {
             EditorGUILayout.LabelField("Build location", string.IsNullOrWhiteSpace(settings.buildPath) ? "<No location>" : settings.buildPath);
             if (GUILayout.Button("Change...", GUILayout.Width(96.0f)))
             {
                 var path = OpenBuildSavePanel(settings.buildPath);
                 if (!string.IsNullOrEmpty(path))
                 {
                     settings.buildPath = path;
                 }
             }
         }
         using (var horizontalScope = new EditorGUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             bool cacheEnable = GUI.enabled;
             GUI.enabled = !string.IsNullOrWhiteSpace(settings.buildPath);
             if (GUILayout.Button("Open Build Location", GUILayout.MaxWidth(256.0f)))
             {
                 Application.OpenURL(settings.buildPath);
             }
             GUI.enabled = cacheEnable;
             GUILayout.FlexibleSpace();
         }
     }
 }
示例#2
0
        private static string OpenBuildSavePanel(string path)
        {
            string newPath = EditorUtility.SaveFolderPanel("Choose location to build a game", path, null);

            if (string.IsNullOrEmpty(newPath))
            {
                return(null);
            }
            settings.buildPath = newPath;
            settings.Save();
            return(newPath);
        }