private void DrawChooseOutputFolders()

in Assets/MRTK/Tools/ExtensionServiceCreator/ExtensionServiceWizard.cs [154:298]


        private void DrawChooseOutputFolders()
        {
            using (var scroll = new EditorGUILayout.ScrollViewScope(outputFoldersScrollPos))
            {
                outputFoldersScrollPos = scroll.scrollPosition;

                useUniversalFolder = EditorGUILayout.ToggleLeft("Place all files in same folder", useUniversalFolder);
                if (useUniversalFolder)
                {
                    var newFolder = EditorGUILayout.ObjectField(TargetFolderLabel, creator.ServiceFolderObject, typeof(DefaultAsset), false);

                    string path = AssetDatabase.GetAssetPath(newFolder);
                    creator.SetAllFolders(path);
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Below are the files you will be generating", EditorStyles.miniLabel);

                using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    string svcFile = creator.ServiceName + ".cs";
                    EditorGUILayout.LabelField(svcFile, EditorStyles.boldLabel);
                    EditorGUILayout.LabelField("This is the main script for your service. It functions similarly to a MonoBehaviour, with Enable, Disable and Update functions.", EditorStyles.wordWrappedMiniLabel);

                    if (!useUniversalFolder)
                    {
                        creator.ServiceFolderObject = EditorGUILayout.ObjectField(TargetFolderLabel, creator.ServiceFolderObject, typeof(DefaultAsset), false);
                    }

                    if (!creator.CanBuildAsset(creator.ServiceFolderObject, creator.ServiceName))
                    {
                        errors.Add($"{svcFile} script cannot be created. Either invalid folder or asset already exists");
                    }
                }

                EditorGUILayout.Space();
                using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    string interfaceFile = creator.InterfaceName + ".cs";
                    EditorGUILayout.LabelField(interfaceFile, EditorStyles.boldLabel);
                    EditorGUILayout.LabelField("This is the interface that other scripts will use to interact with your service.", EditorStyles.wordWrappedMiniLabel);

                    if (!useUniversalFolder)
                    {
                        creator.InterfaceFolderObject = EditorGUILayout.ObjectField(TargetFolderLabel, creator.InterfaceFolderObject, typeof(DefaultAsset), false);
                    }

                    if (!creator.CanBuildAsset(creator.InterfaceFolderObject, creator.InterfaceName))
                    {
                        errors.Add($"{interfaceFile} script cannot be created. Either invalid folder or asset already exists");
                    }
                }

                EditorGUILayout.Space();
                using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    string inspectorFile = creator.InspectorName + ".cs";
                    creator.UsesInspector = EditorGUILayout.ToggleLeft(inspectorFile + " (Optional)", creator.UsesInspector, EditorStyles.boldLabel);
                    EditorGUILayout.LabelField("An optional inspector for your service. This will be displayed in the editor when service inspectors are enabled.", EditorStyles.wordWrappedMiniLabel);

                    if (creator.UsesInspector)
                    {
                        if (!useUniversalFolder)
                        {
                            creator.InspectorFolderObject = EditorGUILayout.ObjectField(TargetFolderLabel, creator.InspectorFolderObject, typeof(DefaultAsset), false);
                        }

                        if (!creator.CanBuildAsset(creator.InspectorFolderObject, creator.InspectorName))
                        {
                            errors.Add($"{inspectorFile} script cannot be created. Either invalid folder or asset already exists");
                        }
                    }
                }

                EditorGUILayout.Space();
                using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    string profileFile = creator.ProfileName + ".cs";
                    creator.UsesProfile = EditorGUILayout.ToggleLeft(profileFile + " (Optional)", creator.UsesProfile, EditorStyles.boldLabel);
                    EditorGUILayout.LabelField("An optional profile script for your service. Profiles are scriptable objects that store permanent config data. If you're not sure whether your service will need a profile, it's best to create one. You can remove it later.", EditorStyles.wordWrappedMiniLabel);

                    if (creator.UsesProfile)
                    {
                        if (!useUniversalFolder)
                        {
                            creator.ProfileFolderObject = EditorGUILayout.ObjectField(TargetFolderLabel, creator.ProfileFolderObject, typeof(DefaultAsset), false);
                        }

                        if (!creator.CanBuildAsset(creator.ProfileFolderObject, creator.ProfileName))
                        {
                            errors.Add($"{profileFile} script cannot be created. Either invalid folder or asset already exists");
                        }
                    }
                }

                if (creator.UsesProfile)
                {
                    EditorGUILayout.Space();
                    using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                    {
                        string profileAssetFile = creator.ProfileAssetName + ".asset";
                        EditorGUILayout.LabelField(profileAssetFile, EditorStyles.boldLabel);
                        EditorGUILayout.LabelField("A default instance of your profile.", EditorStyles.wordWrappedMiniLabel);

                        if (!useUniversalFolder)
                        {
                            creator.ProfileAssetFolderObject = EditorGUILayout.ObjectField(TargetFolderLabel, creator.ProfileAssetFolderObject, typeof(UnityEngine.Object), false);
                        }

                        if (!creator.CanBuildAsset(creator.ProfileAssetFolderObject, creator.ProfileAssetName))
                        {
                            errors.Add($"{profileAssetFile} script cannot be created. Either invalid folder or asset already exists");
                        }
                    }
                }

                EditorGUILayout.Space();

                bool hasErrors = errors.Count > 0;
                if (hasErrors)
                {
                    RenderErrorLog();
                }

                EditorGUILayout.Space();

                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("Back"))
                    {
                        creator.Stage = ExtensionServiceCreator.CreationStage.SelectNameAndPlatform;
                        creator.StoreState();
                    }

                    using (new EditorGUI.DisabledGroupScope(hasErrors))
                    {
                        if (GUILayout.Button("Create Service"))
                        {
                            // Start the async method that will wait for the service to be created
                            CreateAssetsAsync();
                        }
                    }
                }
            }
        }