private void ExportSelectedPrefabs() { var targets = GetWorkerBuilders(); foreach (var target in targets) { EntityPrefabExporter.ExportSelectedEntityPrefabs(target.BuildTarget); } }
private void FindPrefabsInProject() { var guids = EntityPrefabExporter.GetAllPrefabAssetGuids(); foreach (var guid in guids) { var path = AssetDatabase.GUIDToAssetPath(guid); var name = Path.GetFileNameWithoutExtension(path); if (string.IsNullOrEmpty(name)) { Debug.LogWarningFormat("Found a prefab an empty name on path '{0}'. Please give it a name.", path); } else if (prefabs.ContainsKey(name)) { Debug.LogWarningFormat("Duplicate Prefab detected: {0}", path); } else { prefabs.Add(name, path); } } }
/// <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); } } } } } }