/// <summary>
        ///     Performs default clean steps for a Unity worker.
        /// </summary>
        private static void DefaultClean()
        {
            EntityPrefabExportMenus.CleanAllEntityPrefabs();

            CleanPlayers();

            CleanDeployedFramework();
        }
        /// <summary>
        ///     Performs default build steps for a Unity worker.
        /// </summary>
        private static void DefaultBuild()
        {
            Debug.LogFormat("Starting SpatialOS Build");

            if (!string.IsNullOrEmpty(Target))
            {
                Debug.LogFormat(@"Building target ""{0}"", available targets are ""{1}"", ""{2}""", Target, UnityPlayerBuilders.DeploymentTarget, UnityPlayerBuilders.DevelopmentTarget);
            }

            EntityPrefabExportMenus.ExportAllEntityPrefabs();

            var workersToBuild = GetWorkerTypesToBuild();

            foreach (var playerTarget in workersToBuild)
            {
                Debug.LogFormat(@"Building player {0}", playerTarget);
            }

            RunIf(UnityPlayerBuilders.DevelopmentTarget, () => UnityPlayerBuilders.BuildDevelopmentPlayers(workersToBuild));
            RunIf(UnityPlayerBuilders.DeploymentTarget, () => UnityPlayerBuilders.BuildDeploymentPlayers(workersToBuild));

            Debug.LogFormat("Finished SpatialOS Build");
        }
Esempio n. 3
0
        /// <inheritdoc cref="ISpatialOsEditorAddon" />
        public void OnDevGui(Rect rect)
        {
            using (new EditorGUILayout.VerticalScope())
            {
                DrawWorkerTargetSelection();

                using (new EditorGUI.DisabledScope(!SpatialOsEditor.WorkerSelection.AnyWorkersSelected || buildTargets == null || buildTargets.Count == 0))
                {
                    using (new EditorGUILayout.VerticalScope())
                    {
                        GUILayout.Label("Generate from schema", EditorStyles.boldLabel);

                        using (new EditorGUILayout.HorizontalScope())
                        {
                            if (GUILayout.Button(new GUIContent("Build", "Generate code for the currently selected workers."), EditorStyles.toolbarButton))
                            {
                                CodegenWorkers();
                            }

                            if (GUILayout.Button(new GUIContent("Cleanup", "Generate code for the currently selected workers."), EditorStyles.toolbarButton))
                            {
                                CleanupCodegen();
                            }
                        }
                    }

                    EditorGUILayout.Separator();

                    using (new EditorGUILayout.VerticalScope())
                    {
                        GUILayout.Label("Entity prefabs", EditorStyles.boldLabel);

                        using (new EditorGUILayout.HorizontalScope())
                        {
                            if (GUILayout.Button(new GUIContent("Build all", "Build entity prefabs for the selected workers and targets."), EditorStyles.toolbarButton))
                            {
                                ExportPrefabs();
                            }

                            using (new EditorGUI.DisabledScope(!EntityPrefabExporter.AnyPrefabsSelected()))
                            {
                                if (GUILayout.Button(new GUIContent("Build selected", "Build selected entity prefabs for the selected workers and targets."), EditorStyles.toolbarButton))
                                {
                                    ExportSelectedPrefabs();
                                }
                            }

                            if (GUILayout.Button("Cleanup all", EditorStyles.toolbarButton))
                            {
                                EntityPrefabExportMenus.OnCleanEntityPrefabs();
                            }
                        }
                    }

                    EditorGUILayout.Separator();

                    using (new EditorGUILayout.VerticalScope())
                    {
                        GUILayout.Label("Workers", EditorStyles.boldLabel);

                        using (new EditorGUILayout.HorizontalScope())
                        {
                            if (GUILayout.Button(new GUIContent("Build", "Build the currently selected workers."), EditorStyles.toolbarButton))
                            {
                                EditorApplication.update += EditorUpdate;
                            }

                            if (GUILayout.Button(new GUIContent("Cleanup all", "Clean all workers."), EditorStyles.toolbarButton))
                            {
                                UnityPathUtil.EnsureDirectoryClean(UnityPlayerBuilder.PlayerBuildDirectory);
                                UnityPathUtil.EnsureDirectoryClean(UnityPlayerBuilder.PlayerBuildScratchDirectory);
                            }
                        }
                    }
                }
            }
        }