private void DrawEnvironmentInspectorForWorker(WorkerBuildConfiguration configurationForWorker)
        {
            EditorGUILayout.LabelField("Environments", EditorStyles.boldLabel);

            DrawEnvironmentInspector(BuildEnvironment.Local, configurationForWorker);
            DrawEnvironmentInspector(BuildEnvironment.Cloud, configurationForWorker);
        }
        private void DrawScenesInspectorForWorker(WorkerBuildConfiguration configurationForWorker)
        {
            EditorGUILayout.LabelField("Scenes", EditorStyles.boldLabel);

            using (IndentLevelScope(1))
            {
                var scenesToShowInList = configurationForWorker
                                         .ScenesForWorker
                                         .Select((sceneAsset, index) => new SceneItem(sceneAsset, true, scenesInAssetDatabase))
                                         .ToList();

                EditorGUI.BeginChangeCheck();

                var sceneItems = scenesInAssetDatabase
                                 .Where(sceneAsset => !configurationForWorker.ScenesForWorker.Contains(sceneAsset))
                                 .Select(sceneAsset => new SceneItem(sceneAsset, false, scenesInAssetDatabase)).ToList();

                var horizontalLayout = Screen.width > ScreenWidthForHorizontalLayout;

                using (horizontalLayout ? new EditorGUILayout.HorizontalScope() : null)
                {
                    using (horizontalLayout ? new EditorGUILayout.VerticalScope() : null)
                    {
                        EditorGUILayout.LabelField("Scenes to include (in order)");

                        DrawIndentedList(scenesToShowInList, ReorderableListFlags.ShowIndices | ReorderableListFlags.EnableReordering,
                                         SceneItem.Drawer);
                    }

                    using (horizontalLayout ? new EditorGUILayout.VerticalScope() : null)
                    {
                        using (horizontalLayout ? IndentLevelScope(-EditorGUI.indentLevel) : null)
                        {
                            EditorGUILayout.LabelField("Exclude");

                            DrawIndentedList(sceneItems,
                                             ReorderableListFlags.None,
                                             SceneItem.Drawer);
                        }
                    }
                }

                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(target);
                    Undo.RecordObject(target, "Configure scenes for worker");

                    configurationForWorker.ScenesForWorker = scenesToShowInList.Concat(sceneItems)
                                                             .Where(item => item.Included)
                                                             .Select(item => item.SceneAsset).ToArray();

                    scenesChanged = true;
                }
            }
        }
        private void DrawEnvironmentInspector(BuildEnvironment environment,
                                              WorkerBuildConfiguration configurationForWorker)
        {
            using (IndentLevelScope(1))
            {
                EditorGUILayout.LabelField(environment.ToString());

                var environmentConfiguration =
                    configurationForWorker.GetEnvironmentConfig(environment);

                ConfigureBuildPlatforms(environmentConfiguration);
                ConfigureBuildOptions(environmentConfiguration);
            }
        }
예제 #4
0
        private SceneAsset[] GetScenesForWorker(WorkerPlatform workerPlatform)
        {
            WorkerBuildConfiguration configurationForWorker = null;

            if (WorkerBuildConfigurations != null)
            {
                configurationForWorker =
                    WorkerBuildConfigurations.FirstOrDefault(config => config.WorkerPlatform == workerPlatform);
            }

            return(configurationForWorker == null
                ? new SceneAsset[0]
                : configurationForWorker.ScenesForWorker);
        }
        private void DrawWorkerConfiguration(WorkerBuildConfiguration configurationForWorker)
        {
            var platformName = configurationForWorker.WorkerPlatform.ToString();

            configurationForWorker.ShowFoldout = EditorGUILayout.Foldout(configurationForWorker.ShowFoldout, platformName);

            if (configurationForWorker.ShowFoldout)
            {
                using (IndentLevelScope(1))
                {
                    DrawScenesInspectorForWorker(configurationForWorker);
                    DrawEnvironmentInspectorForWorker(configurationForWorker);
                }
            }
        }
예제 #6
0
        private void ResetToDefault()
        {
            // Build default settings
            var client = new WorkerBuildConfiguration()
            {
                WorkerPlatform  = WorkerPlatform.UnityClient,
                ScenesForWorker = AssetDatabase.FindAssets("t:Scene")
                                  .Select(AssetDatabase.GUIDToAssetPath)
                                  .Where(path => path.Contains(WorkerPlatform.UnityClient.ToString()))
                                  .Select(AssetDatabase.LoadAssetAtPath <SceneAsset>).ToArray(),
                LocalBuildConfig = new BuildEnvironmentConfig()
                {
                    BuildPlatforms = SpatialBuildPlatforms.Current,
                    BuildOptions   = BuildOptions.Development
                },
                CloudBuildConfig = new BuildEnvironmentConfig()
                {
                    BuildPlatforms = SpatialBuildPlatforms.Current
                }
            };

            var worker = new WorkerBuildConfiguration()
            {
                WorkerPlatform  = WorkerPlatform.UnityWorker,
                ScenesForWorker = AssetDatabase.FindAssets("t:Scene")
                                  .Select(AssetDatabase.GUIDToAssetPath)
                                  .Where(path => path.Contains(WorkerPlatform.UnityWorker.ToString()))
                                  .Select(AssetDatabase.LoadAssetAtPath <SceneAsset>).ToArray(),
                LocalBuildConfig = new BuildEnvironmentConfig()
                {
                    BuildPlatforms = SpatialBuildPlatforms.Current,
                    BuildOptions   = BuildOptions.EnableHeadlessMode
                },
                CloudBuildConfig = new BuildEnvironmentConfig()
                {
                    BuildPlatforms = SpatialBuildPlatforms.Linux,
                    BuildOptions   = BuildOptions.EnableHeadlessMode
                }
            };

            WorkerBuildConfigurations = new WorkerBuildConfiguration[]
            {
                client, worker
            };

            isInitialised = true;
        }