public override void DrawGPUInstancerPrototypeActions() { if (Application.isPlaying) { return; } GUILayout.Space(10); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_actions, GPUInstancerEditorConstants.Styles.boldLabel, false); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.delete, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deleteAreYouSure + "\n\"" + _prefabManager.selectedPrototype.ToString() + "\"", GPUInstancerEditorConstants.TEXT_remove, GPUInstancerEditorConstants.TEXT_cancel)) { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deletePrototypeAreYouSure + "\n\"" + _prefabManager.selectedPrototype.ToString() + "\"", GPUInstancerEditorConstants.TEXT_delete, GPUInstancerEditorConstants.TEXT_keepPrototypeDefinition)) { if (((GPUInstancerPrefabPrototype)_prefabManager.selectedPrototype).meshRenderersDisabled) { SetRenderersEnabled((GPUInstancerPrefabPrototype)_prefabManager.selectedPrototype, true); } _prefabManager.DeletePrototype(_prefabManager.selectedPrototype); _prefabManager.selectedPrototype = null; } else { _prefabManager.DeletePrototype(_prefabManager.selectedPrototype, false); _prefabManager.selectedPrototype = null; } } }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_delete); }
public void DrawMapMagicPrefabGlobalInfoBox() { EditorGUI.BeginDisabledGroup(Application.isPlaying); EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_prefabGlobal, GPUInstancerEditorConstants.Styles.boldLabel); EditorGUILayout.PropertyField(prop_prefabSingleton, GPUInstancerEditorConstants.Contents.useSinglePrefabManager); bool disableMeshRenderers = prop_prefabDisableMR.boolValue; EditorGUILayout.PropertyField(prop_prefabDisableMR, GPUInstancerEditorConstants.Contents.disableMeshRenderers); if (prop_prefabDisableMR.boolValue && prop_prefabSingleton.boolValue) { EditorGUILayout.PropertyField(prop_prefabRunInThreads, GPUInstancerEditorConstants.Contents.runInThreads); } else { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.PropertyField(prop_prefabRunInThreads, GPUInstancerEditorConstants.Contents.runInThreads); EditorGUI.EndDisabledGroup(); prop_prefabRunInThreads.boolValue = false; } foreach (GPUInstancerPrefabPrototype prefabPrototype in _mapMagicIntegration.prefabPrototypes) { if (disableMeshRenderers != prop_prefabDisableMR.boolValue) { GPUInstancerPrefabManagerEditor.SetRenderersEnabled(prefabPrototype, disableMeshRenderers); } } EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); }
public override void DrawPrototypeBoxButtons() { if (!Application.isPlaying) { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.generatePrototypes, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_generatePrototypesConfirmation, GPUInstancerEditorConstants.TEXT_generatePrototypeAreYouSure, GPUInstancerEditorConstants.TEXT_generatePrototypes, GPUInstancerEditorConstants.TEXT_cancel)) { _treeManager.GeneratePrototypes(true); } }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_generatePrototypesTree); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.regenerateBillboards, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_regenerateBillboardsConfirmation, GPUInstancerEditorConstants.TEXT_regenerateBillboardsAreYouSure, GPUInstancerEditorConstants.TEXT_regenerateBillboards, GPUInstancerEditorConstants.TEXT_cancel)) { foreach (GPUInstancerPrototype prototype in _treeManager.prototypeList) { if (prototype.useGeneratedBillboard) { GPUInstancerUtility.GeneratePrototypeBillboard(prototype, true); } } } }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_regenerateBillboards); } }
public override void DrawGPUInstancerPrototypeActions() { GUILayout.Space(10); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_actions, GPUInstancerEditorConstants.Styles.boldLabel, false); DrawDeleteButton(); }
void OnGUI() { if (_managerEditor == null || _managerEditor.GetManager() == null) { Close(); return; } if (dropIcon == null) { dropIcon = Resources.Load <Texture2D>(GPUInstancerConstants.EDITOR_TEXTURES_PATH + #if UNITY_PRO_LICENSE GPUInstancerEditorConstants.DROP_ICON_PRO #else GPUInstancerEditorConstants.DROP_ICON #endif ); } Rect buttonRect = GUILayoutUtility.GetRect(360, 180, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GPUInstancerEditorConstants.DrawColoredButton(new GUIContent("<size=18>Drop Files Here</size>", dropIcon), Color.clear, #if UNITY_PRO_LICENSE Color.white, #else GPUInstancerEditorConstants.Colors.dimgray, #endif FontStyle.Bold, buttonRect, null, true, true, (o) => { _managerEditor.AddPickerObject(o); }); }
public void DrawGPUInstancerPrototypeAddButton() { Rect prototypeRect = GUILayoutUtility.GetRect(PROTOTYPE_RECT_SIZE, PROTOTYPE_RECT_SIZE, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)); Rect iconRect = new Rect(prototypeRect.position + PROTOTYPE_RECT_PADDING_VECTOR, PROTOTYPE_RECT_SIZE_VECTOR); iconRect.height -= 22; GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.add, GPUInstancerEditorConstants.Colors.lightBlue, Color.white, FontStyle.Bold, iconRect, () => { _pickerOverride = null; pickerControlID = EditorGUIUtility.GetControlID(FocusType.Passive) + 100; ShowObjectPicker(); }, true, true, (o) => { AddPickerObject(o); }); iconRect.y += iconRect.height; iconRect.height = 22; GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.addMulti, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, iconRect, () => { GPUInstancerMultiAddWindow.ShowWindow(GUIUtility.GUIToScreenPoint(iconRect.position), this); }, true, true, (o) => { AddPickerObject(o); }); }
public static void DrawWikiButton(Rect buttonRect, string hash) { GPUInstancerEditorConstants.DrawColoredButton(new GUIContent("Wiki"), GPUInstancerEditorConstants.Colors.lightBlue, Color.white, FontStyle.Bold, buttonRect, () => { Application.OpenURL("https://wiki.gurbu.com/index.php?title=GPU_Instancer:GettingStarted" + hash); } ); }
public virtual void DrawGPUInstancerPrototypeButton(GPUInstancerPrototype prototype, GUIContent prototypeContent, bool isSelected, UnityAction handleSelect) { if (prototypeContent.image == null) { prototypeContent.image = GetPreview(prototype); } Rect prototypeRect = GUILayoutUtility.GetRect(PROTOTYPE_RECT_SIZE, PROTOTYPE_RECT_SIZE, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)); Rect iconRect = new Rect(prototypeRect.position + new Vector2(PROTOTYPE_RECT_PADDING, PROTOTYPE_RECT_PADDING), new Vector2(PROTOTYPE_RECT_SIZE - PROTOTYPE_RECT_PADDING * 2, PROTOTYPE_RECT_SIZE - PROTOTYPE_RECT_PADDING * 2)); GUI.SetNextControlName(prototypeContent.tooltip); if (isSelected) { GPUInstancerEditorConstants.DrawColoredButton(prototypeContent, string.IsNullOrEmpty(prototype.warningText) ? GPUInstancerEditorConstants.Colors.lightGreen : GPUInstancerEditorConstants.Colors.lightred, Color.black, FontStyle.Normal, iconRect, null); } else { GPUInstancerEditorConstants.DrawColoredButton(prototypeContent, string.IsNullOrEmpty(prototype.warningText) ? GUI.backgroundColor : GPUInstancerEditorConstants.Colors.darkred, Color.black, FontStyle.Normal, iconRect, () => { if (handleSelect != null) { handleSelect(); } }); } }
public override void DrawGPUInstancerPrototypeActions() { GUILayout.Space(10); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_actions, GPUInstancerEditorConstants.Styles.boldLabel, false); if (!_detailManager.editorDataChanged) { EditorGUI.BeginDisabledGroup(true); } GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.applyChangesToTerrain, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { _detailManager.ApplyEditorDataChanges(); }); if (!_detailManager.editorDataChanged) { EditorGUI.EndDisabledGroup(); } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_applyChangesToTerrain); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.delete, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deleteAreYouSure + "\n\"" + _detailManager.selectedPrototype.ToString() + "\"", GPUInstancerEditorConstants.TEXT_delete, GPUInstancerEditorConstants.TEXT_cancel)) { _detailManager.DeletePrototype(_detailManager.selectedPrototype); _detailManager.selectedPrototype = null; } }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_delete); }
public void DrawMapMagicImportBox() { EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_mapMagicImporter, GPUInstancerEditorConstants.Styles.boldLabel); _mapMagicIntegration.importDetails = EditorGUILayout.Toggle(GPUInstancerEditorConstants.TEXT_mapMagicImportDetails, _mapMagicIntegration.importDetails); _mapMagicIntegration.importTrees = EditorGUILayout.Toggle(GPUInstancerEditorConstants.TEXT_mapMagicImportTrees, _mapMagicIntegration.importTrees); if (_mapMagicIntegration.prefabs != null && _mapMagicIntegration.prefabs.Count > 0) { _mapMagicIntegration.importObjects = EditorGUILayout.Toggle(GPUInstancerEditorConstants.TEXT_mapMagicImportObjects, _mapMagicIntegration.importObjects); if (_mapMagicIntegration.importObjects) { EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_mapMagicObjectsList, GPUInstancerEditorConstants.Styles.boldLabel); foreach (GameObject prefab in _mapMagicIntegration.prefabs) { bool isPrefabSelected = _mapMagicIntegration.selectedPrefabs.Contains(prefab); bool result = EditorGUILayout.Toggle(prefab.gameObject.name, isPrefabSelected); if (result && !isPrefabSelected) { _mapMagicIntegration.selectedPrefabs.Add(prefab); } else if (!result && isPrefabSelected) { _mapMagicIntegration.selectedPrefabs.Remove(prefab); } } EditorGUILayout.EndVertical(); } } Rect buttonRect = GUILayoutUtility.GetRect(100, 25, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.mapMagicImport, GPUInstancerEditorConstants.Colors.lightBlue, Color.white, FontStyle.Bold, buttonRect, () => { _mapMagicIntegration.GeneratePrototypes(); prototypeList = new List <GPUInstancerPrototype>(); if (_mapMagicIntegration.detailPrototypes != null && _mapMagicIntegration.detailPrototypes.Count > 0) { prototypeList.AddRange(_mapMagicIntegration.detailPrototypes); } if (_mapMagicIntegration.treePrototypes != null && _mapMagicIntegration.treePrototypes.Count > 0) { prototypeList.AddRange(_mapMagicIntegration.treePrototypes); } if (_mapMagicIntegration.prefabPrototypes != null && _mapMagicIntegration.prefabPrototypes.Count > 0) { prototypeList.AddRange(_mapMagicIntegration.prefabPrototypes); } prototypeContents = null; }); EditorGUILayout.EndVertical(); }
public void DrawDebugBox(GPUInstancerEditorSimulator simulator = null) { if (!Application.isPlaying) { EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); Rect foldoutRect = GUILayoutUtility.GetRect(0, 20, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)); foldoutRect.x += 12; showDebugBox = EditorGUI.Foldout(foldoutRect, showDebugBox, GPUInstancerEditorConstants.TEXT_debug, true, GPUInstancerEditorConstants.Styles.foldout); if (showDebugBox) { if (simulator != null) { if (simulator.simulateAtEditor) { if (simulator.initializingInstances) { EditorGUI.BeginDisabledGroup(true); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorPrep, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, Rect.zero, null); EditorGUI.EndDisabledGroup(); } else { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorStop, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { simulator.StopSimulation(); }); } } else { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditor, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { simulator.StartSimulation(); }); } } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_simulator); _manager.keepSimulationLive = EditorGUILayout.Toggle("Keep Simulation Live", _manager.keepSimulationLive); if (_manager.keepSimulationLive) { _manager.updateSimulation = EditorGUILayout.Toggle(new GUIContent("Update Simulation On Change", "Update Simulation On Change"), _manager.updateSimulation); EditorGUILayout.HelpBox("Simulation is kept alive. The simulation might not show every change on terrain details. Changing some prototype settings during the simulation can also cause errors. Please stop and start the simulation again to solve these issues.", MessageType.Warning); } } EditorGUILayout.EndVertical(); } }
public virtual void DrawRegisteredPrefabsBoxList() { if (Application.isPlaying && _manager.runtimeDataList != null && _manager.runtimeDataList.Count > 0) { int totalInsanceCount = 0; int totalDrawCallCount = 0; int totalShadowDrawCall = 0; foreach (GPUInstancerRuntimeData runtimeData in _manager.runtimeDataList) { if (runtimeData == null) { continue; } int drawCallCount = 0; int shadowDrawCallCount = 0; if (runtimeData.transformationMatrixVisibilityBuffer != null && runtimeData.instanceLODs != null && runtimeData.bufferSize > 0 && runtimeData.instanceCount > 0) { for (int i = 0; i < runtimeData.instanceLODs.Count; i++) { for (int j = 0; j < runtimeData.instanceLODs[i].renderers.Count; j++) { GPUInstancerRenderer gpuiRenderer = runtimeData.instanceLODs[i].renderers[j]; if (!GPUInstancerUtility.IsInLayer(prop_layerMask.intValue, gpuiRenderer.layer)) { continue; } drawCallCount += gpuiRenderer.materials.Count; if (runtimeData.prototype.isShadowCasting && gpuiRenderer.castShadows) { shadowDrawCallCount += gpuiRenderer.materials.Count * QualitySettings.shadowCascades; } } } } GUILayout.Label(runtimeData.prototype.ToString() + " Instance Count: " + runtimeData.instanceCount + "\n" + runtimeData.prototype.ToString() + " Geometry Draw Call Count: " + drawCallCount + (shadowDrawCallCount > 0 ? "\n" + runtimeData.prototype.ToString() + " Shadow Draw Call Count: " + shadowDrawCallCount : ""), GPUInstancerEditorConstants.Styles.label); totalInsanceCount += runtimeData.instanceCount; totalDrawCallCount += drawCallCount; totalShadowDrawCall += shadowDrawCallCount; } GUILayout.Label("\nTotal Instance Count: " + totalInsanceCount + "\n\n" + "Total Geometry Draw Call Count: " + totalDrawCallCount + "\n" + "Total Shadow Draw Call Count: " + totalShadowDrawCall + " (" + QualitySettings.shadowCascades + " Cascades)" + "\n\n" + "Total Draw Call Count: " + (totalDrawCallCount + totalShadowDrawCall) , GPUInstancerEditorConstants.Styles.boldLabel); } else { GPUInstancerEditorConstants.DrawCustomLabel("No registered prefabs.", GPUInstancerEditorConstants.Styles.label, false); } }
public void DrawGPUInstancerManagerGUILayout() { EditorGUI.BeginDisabledGroup(Application.isPlaying); DrawRegisterPrefabsBox(); EditorGUI.EndDisabledGroup(); int prototypeRowCount = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 30f) / PROTOTYPE_RECT_SIZE); EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_prototypes, GPUInstancerEditorConstants.Styles.boldLabel); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prototypes); int i = 0; EditorGUILayout.BeginHorizontal(); foreach (GPUInstancerPrefabPrototype prototype in _prefabManager.prototypeList) { if (prototype == null) { continue; } CheckPrefabRigidbodies(prototype); if (i != 0 && i % prototypeRowCount == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } DrawGPUInstancerPrototypeButton(prototype, prototypeContents[i]); i++; } if (i != 0 && i % prototypeRowCount == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } if (!Application.isPlaying) { DrawGPUInstancerPrototypeAddButton(); } EditorGUILayout.EndHorizontal(); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_addprototypeprefab); DrawGPUInstancerPrototypeBox(_prefabManager.selectedPrototype, _prefabManager.isFrustumCulling, _prefabManager.isOcclusionCulling, _prefabManager.shaderBindings, _prefabManager.billboardAtlasBindings); EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { GPUInstancerTerrainProxy terrainProxy = (GPUInstancerTerrainProxy)target; if (terrainProxy.detailManager != null) { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.goToGPUInstancerDetail, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { if (terrainProxy.detailManager != null && terrainProxy.detailManager.gameObject != null) { Selection.activeGameObject = terrainProxy.detailManager.gameObject; } }); } if (terrainProxy.treeManager != null) { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.goToGPUInstancerTree, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { if (terrainProxy.treeManager != null && terrainProxy.treeManager.gameObject != null) { Selection.activeGameObject = terrainProxy.treeManager.gameObject; } }); } EditorGUILayout.HelpBox(GPUInstancerEditorConstants.HELPTEXT_terrainProxyWarning, MessageType.Warning); // select terrain tool if (terrainProxy.terrainSelectedToolIndex > 0) { try { if (terrainInspectorType == null) { terrainInspectorType = Assembly.GetAssembly(typeof(Editor)).GetType("UnityEditor.TerrainInspector"); } PropertyInfo selectedTool = terrainInspectorType.GetProperty("selectedTool", BindingFlags.NonPublic | BindingFlags.Instance); UnityEngine.Object[] terrainInspectors = Resources.FindObjectsOfTypeAll(terrainInspectorType); foreach (UnityEngine.Object terrainInspector in terrainInspectors) { //Debug.Log(selectedTool.GetValue(terrainInspector, new object[0])); selectedTool.SetValue(terrainInspector, terrainProxy.terrainSelectedToolIndex, new object[0]); break; } } catch (Exception) { }; terrainProxy.terrainSelectedToolIndex = -1; } }
public static void DrawGPUInstancerPrototypeInfo(GPUInstancerPrototype selectedPrototype, UnityAction <string> DrawHelpText, Object component, UnityAction OnEditorDataChanged, GPUInstancerShaderBindings shaderBindings, GPUInstancerEditorSimulator simulator, GPUInstancerTerrainSettings terrainSettings) { GPUInstancerTreePrototype treePrototype = (GPUInstancerTreePrototype)selectedPrototype; EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_treeSettings, GPUInstancerEditorConstants.Styles.boldLabel); treePrototype.isApplyRotation = EditorGUILayout.Toggle(GPUInstancerEditorConstants.TEXT_useRandomTreeTotation, treePrototype.isApplyRotation); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_useRandomTreeTotation); EditorGUILayout.EndVertical(); }
public void DrawMapMagicPrefabPrototypesBox() { int prototypeRowCount = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 30f) / PROTOTYPE_RECT_SIZE); EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_mapMagicPrefabPrototypes, GPUInstancerEditorConstants.Styles.boldLabel); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prototypes); int i = 0; EditorGUILayout.BeginHorizontal(); foreach (GPUInstancerPrototype prototype in _mapMagicIntegration.prefabPrototypes) { if (prototype == null) { continue; } int prototypeContentIndex = (_mapMagicIntegration.detailPrototypes == null ? 0 : _mapMagicIntegration.detailPrototypes.Count) + (_mapMagicIntegration.treePrototypes == null ? 0 : _mapMagicIntegration.treePrototypes.Count) + i; if (i != 0 && i % prototypeRowCount == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } if (prototypeContents != null && prototypeContents.Length > prototypeContentIndex && prototypeContents[prototypeContentIndex] != null) { DrawGPUInstancerPrototypeButton(prototype, prototypeContents[prototypeContentIndex], prototype == _mapMagicIntegration.selectedPrefabPrototype, () => { _mapMagicIntegration.selectedPrefabPrototype = prototype; GUI.FocusControl(prototypeContents[prototypeContentIndex].tooltip); }); } i++; } if (i != 0 && i % prototypeRowCount == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); } EditorGUILayout.EndHorizontal(); DrawGPUInstancerPrototypeBox(_mapMagicIntegration.selectedPrefabPrototype, prop_isManagerFrustumCulling.boolValue, prop_isManagerOcclusionCulling.boolValue, _mapMagicIntegration.shaderBindings, _mapMagicIntegration.billboardAtlasBindings); EditorGUILayout.EndVertical(); }
public override void DrawGPUInstancerPrototypeAdvancedActions() { if (Application.isPlaying) { return; } GUILayout.Space(10); EditorGUILayout.BeginVertical(); // title Rect foldoutRect = GUILayoutUtility.GetRect(0, 20, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)); foldoutRect.x += 12; showAdvancedBox = EditorGUI.Foldout(foldoutRect, showAdvancedBox, GPUInstancerEditorConstants.TEXT_advancedActions, true, GPUInstancerEditorConstants.Styles.foldout); //GUILayout.Space(10); if (showAdvancedBox) { EditorGUILayout.HelpBox(GPUInstancerEditorConstants.HELPTEXT_advancedActions, MessageType.Warning); GPUInstancerPrefabPrototype prefabPrototype = (GPUInstancerPrefabPrototype)_prefabManager.selectedPrototype; if (prefabPrototype != null) { if (prefabPrototype.meshRenderersDisabled) { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.enableMeshRenderers, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { GPUInstancerPrefabManagerEditor.SetRenderersEnabled(prefabPrototype, true); }); } else { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.disableMeshRenderers, GPUInstancerEditorConstants.Colors.lightBlue, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_disableMeshRenderers, GPUInstancerEditorConstants.TEXT_disableMeshRenderersAreYouSure, "Yes", "No")) { GPUInstancerPrefabManagerEditor.SetRenderersEnabled(prefabPrototype, false); } }); } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_disableMeshRenderers); } } EditorGUILayout.EndVertical(); }
public override void DrawGPUInstancerPrototypeActions() { GUILayout.Space(10); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_actions, GPUInstancerEditorConstants.Styles.boldLabel, false); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.delete, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deleteAreYouSure + "\n\"" + _treeManager.selectedPrototype.ToString() + "\"", GPUInstancerEditorConstants.TEXT_delete, GPUInstancerEditorConstants.TEXT_cancel)) { _treeManager.DeletePrototype(_treeManager.selectedPrototype); _treeManager.selectedPrototype = null; } }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_delete); }
public static bool DrawGPUInstancerPrototypeInfo(List <GPUInstancerPrototype> selectedPrototypeList, UnityAction <string> DrawHelpText, Object component, UnityAction OnEditorDataChanged, GPUInstancerEditorSimulator simulator, GPUInstancerTerrainSettings terrainSettings) { GPUInstancerTreePrototype prototype0 = (GPUInstancerTreePrototype)selectedPrototypeList[0]; #region Determine Multiple Values bool hasChanged = false; bool isApplyRotationMixed = false; bool isApplyRotation = prototype0.isApplyRotation; bool isApplyPrefabScaleMixed = false; bool isApplyPrefabScale = prototype0.isApplyPrefabScale; bool isApplyTerrainHeightMixed = false; bool isApplyTerrainHeight = prototype0.isApplyTerrainHeight; for (int i = 1; i < selectedPrototypeList.Count; i++) { GPUInstancerTreePrototype prototypeI = (GPUInstancerTreePrototype)selectedPrototypeList[i]; if (!isApplyRotationMixed && isApplyRotation != prototypeI.isApplyRotation) { isApplyRotationMixed = true; } if (!isApplyPrefabScaleMixed && isApplyPrefabScale != prototypeI.isApplyPrefabScale) { isApplyPrefabScaleMixed = true; } if (!isApplyTerrainHeightMixed && isApplyTerrainHeight != prototypeI.isApplyTerrainHeight) { isApplyTerrainHeightMixed = true; } } #endregion Determine Multiple Values EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_treeSettings, GPUInstancerEditorConstants.Styles.boldLabel); hasChanged |= MultiToggle(selectedPrototypeList, GPUInstancerEditorConstants.TEXT_useRandomTreeRotation, isApplyRotation, isApplyRotationMixed, (p, v) => ((GPUInstancerTreePrototype)p).isApplyRotation = v); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_useRandomTreeRotation); hasChanged |= MultiToggle(selectedPrototypeList, GPUInstancerEditorConstants.TEXT_useTerrainHeight, isApplyTerrainHeight, isApplyTerrainHeightMixed, (p, v) => ((GPUInstancerTreePrototype)p).isApplyTerrainHeight = v); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_useTerrainHeight); hasChanged |= MultiToggle(selectedPrototypeList, GPUInstancerEditorConstants.TEXT_usePrefabScale, isApplyPrefabScale, isApplyPrefabScaleMixed, (p, v) => ((GPUInstancerTreePrototype)p).isApplyPrefabScale = v); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_usePrefabScale); EditorGUILayout.EndVertical(); return(hasChanged); }
public void DrawGPUInstancerPrototypeAddMultiButtonTextMode() { Rect prototypeRect = GUILayoutUtility.GetRect(PROTOTYPE_TEXT_RECT_SIZE_X, PROTOTYPE_TEXT_RECT_SIZE_Y, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)); Rect iconRect = new Rect(prototypeRect.position + PROTOTYPE_RECT_PADDING_VECTOR, PROTOTYPE_TEXT_RECT_SIZE_VECTOR); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.addMultiTextMode, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, iconRect, () => { GPUInstancerMultiAddWindow.ShowWindow(GUIUtility.GUIToScreenPoint(iconRect.position), this); }, true, true, (o) => { AddPickerObject(o); }); }
public void DrawGPUInstancerPrototypeAddButton() { Rect prototypeRect = GUILayoutUtility.GetRect(PROTOTYPE_RECT_SIZE, PROTOTYPE_RECT_SIZE, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)); Rect iconRect = new Rect(prototypeRect.position + PROTOTYPE_RECT_PADDING_VECTOR, PROTOTYPE_RECT_SIZE_VECTOR); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.add, GPUInstancerEditorConstants.Colors.lightBlue, Color.white, FontStyle.Bold, iconRect, () => { _manager.pickerControlID = EditorGUIUtility.GetControlID(FocusType.Passive) + 100; _manager.ShowObjectPicker(); }, true, true, (o) => { _manager.AddPickerObject(o); }); }
public override void DrawSettingContents() { EditorGUI.BeginDisabledGroup(Application.isPlaying); //EditorGUILayout.PropertyField(prop_settings); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField(GPUInstancerEditorConstants.TEXT_terrain, _treeManager.terrain, typeof(Terrain), true); EditorGUI.EndDisabledGroup(); EditorGUILayout.BeginHorizontal(); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.paintOnTerrain, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { if (_treeManager.terrain != null) { GPUInstancerTerrainProxy proxy = _treeManager.AddProxyToTerrain(); Selection.activeGameObject = _treeManager.terrain.gameObject; proxy.terrainSelectedToolIndex = 4; } }); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.removeTerrain, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_removeTerrainConfirmation, GPUInstancerEditorConstants.TEXT_removeTerrainAreYouSure, GPUInstancerEditorConstants.TEXT_unset, GPUInstancerEditorConstants.TEXT_cancel)) { _treeManager.SetupManagerWithTerrain(null); } }); EditorGUILayout.EndHorizontal(); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_terrain); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); DrawCameraDataFields(); DrawCullingSettings(_treeManager.prototypeList); DrawFloatingOriginFields(); DrawLayerMaskFields(); }
public void DrawDetailTerrainAddButton() { GUILayout.Space(10); Rect buttonRect = GUILayoutUtility.GetRect(100, 40, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.setTerrain, GPUInstancerEditorConstants.Colors.lightBlue, Color.black, FontStyle.Bold, buttonRect, () => { _detailManager.pickerControlID = EditorGUIUtility.GetControlID(FocusType.Passive) + 100; _detailManager.ShowTerrainPicker(); }, true, true, (o) => { _detailManager.AddTerrainPickerObject(o); }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_setTerrain, true); GUILayout.Space(10); }
public void DrawDebugBox(GPUInstancerEditorSimulator simulator = null) { if (!Application.isPlaying) { EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_debug, GPUInstancerEditorConstants.Styles.boldLabel); if (simulator != null) { if (simulator.simulateAtEditor) { if (simulator.initializingInstances) { EditorGUI.BeginDisabledGroup(true); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorPrep, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, Rect.zero, null); EditorGUI.EndDisabledGroup(); } else { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorStop, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { simulator.StopSimulation(); }); } } else { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditor, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { simulator.StartSimulation(); }); } } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_simulator); EditorGUILayout.EndVertical(); } }
public virtual void DrawDeleteButton() { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.delete, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { string selectedPrototypesText = ""; foreach (GPUInstancerPrototype prototype in _manager.selectedPrototypeList) { selectedPrototypesText += "\n\"" + prototype.ToString() + "\""; } if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deleteAreYouSure + selectedPrototypesText, GPUInstancerEditorConstants.TEXT_delete, GPUInstancerEditorConstants.TEXT_cancel)) { foreach (GPUInstancerPrototype prototype in _manager.selectedPrototypeList) { _manager.DeletePrototype(prototype); } _manager.selectedPrototypeList.Clear(); } }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_delete); }
public override void DrawPrefabField(GPUInstancerPrototype selectedPrototype) { EditorGUILayout.BeginHorizontal(); base.DrawPrefabField(selectedPrototype); if (!Application.isPlaying) { Rect prototypeRect = GUILayoutUtility.GetRect(120, 20, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.editPrefab, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, prototypeRect, () => { _pickerOverride = selectedPrototype; pickerControlID = EditorGUIUtility.GetControlID(FocusType.Passive) + 100; ShowObjectPicker(); }, true, true, (o) => { AddPickerObject(o, selectedPrototype); prototypeContents = null; }); } EditorGUILayout.EndHorizontal(); }
public void DrawRegisterPrefabsBox() { EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_registeredPrefabs, GPUInstancerEditorConstants.Styles.boldLabel); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.registerPrefabsInScene, GPUInstancerEditorConstants.Colors.darkBlue, Color.white, FontStyle.Bold, Rect.zero, () => { Undo.RecordObject(_prefabManager, "Register prefabs in scene"); _prefabManager.RegisterPrefabsInScene(); }); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_registerPrefabsInScene); if (!Application.isPlaying && _prefabManager.registeredPrefabs.Count > 0) { foreach (RegisteredPrefabsData rpd in _prefabManager.registeredPrefabs) { GPUInstancerEditorConstants.DrawCustomLabel(rpd.prefabPrototype.ToString() + " Instance Count: " + rpd.registeredPrefabs.Count, GPUInstancerEditorConstants.Styles.label, false); } } else if (Application.isPlaying && _prefabManager.GetRegisteredPrefabsRuntimeData() != null && _prefabManager.GetRegisteredPrefabsRuntimeData().Count > 0) { foreach (GPUInstancerPrototype p in _prefabManager.GetRegisteredPrefabsRuntimeData().Keys) { GPUInstancerEditorConstants.DrawCustomLabel(p.ToString() + " Instance Count: " + _prefabManager.GetRegisteredPrefabsRuntimeData()[p].Count, GPUInstancerEditorConstants.Styles.label, false); } } else { GPUInstancerEditorConstants.DrawCustomLabel("No registered prefabs.", GPUInstancerEditorConstants.Styles.label, false); } EditorGUILayout.EndVertical(); }
public void DrawTreeGlobalInfoBox() { EditorGUI.BeginDisabledGroup(Application.isPlaying); EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_treeGlobal, GPUInstancerEditorConstants.Styles.boldLabel); EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField(GPUInstancerEditorConstants.TEXT_terrainSettingsSO, _treeManager.terrainSettings, typeof(GPUInstancerTerrainSettings), false); EditorGUI.EndDisabledGroup(); float newMaxTreeDistance = EditorGUILayout.Slider(GPUInstancerEditorConstants.TEXT_maxTreeDistance, _treeManager.terrainSettings.maxTreeDistance, 0, GPUInstancerEditorConstants.MAX_TREE_DISTANCE); if (_treeManager.terrainSettings.maxTreeDistance != newMaxTreeDistance) { foreach (GPUInstancerPrototype p in _treeManager.prototypeList) { if (p.maxDistance == _treeManager.terrainSettings.maxTreeDistance || p.maxDistance > newMaxTreeDistance) { p.maxDistance = newMaxTreeDistance; EditorUtility.SetDirty(p); } } _treeManager.terrainSettings.maxTreeDistance = newMaxTreeDistance; } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_maxTreeDistance); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_treeManager, "Editor data changed."); _treeManager.OnEditorDataChanged(); EditorUtility.SetDirty(_treeManager.terrainSettings); } EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); }
public override void OnInspectorGUI() { if (_prefabScripts != null) { if (_prefabScripts.Length >= 1 && _prefabScripts[0] != null && _prefabScripts[0].prefabPrototype != null) { bool isPrefab = _prefabScripts[0].prefabPrototype.prefabObject == _prefabScripts[0].gameObject; if (_prefabScripts.Length == 1) { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField(GPUInstancerEditorConstants.TEXT_prototypeSO, _prefabScripts[0].prefabPrototype, typeof(GPUInstancerPrefabPrototype), false); EditorGUI.EndDisabledGroup(); if (!isPrefab) { if (Application.isPlaying) { if (_prefabScripts[0].state == PrefabInstancingState.Instanced) { GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_prefabInstancingActive + _prefabScripts[0].gpuInstancerID, GPUInstancerEditorConstants.Styles.boldLabel); } else if (_prefabScripts[0].state == PrefabInstancingState.Disabled) { GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_prefabInstancingDisabled + _prefabScripts[0].gpuInstancerID, GPUInstancerEditorConstants.Styles.boldLabel); } else { GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_prefabInstancingNone, GPUInstancerEditorConstants.Styles.boldLabel); } } } } if (isPrefab && !Application.isPlaying) { foreach (GPUInstancerPrefab prefabScript in _prefabScripts) { if (prefabScript != null && prefabScript.prefabPrototype != null) { GPUInstancerPrefabManagerEditor.CheckPrefabRigidbodies(prefabScript.prefabPrototype); } } EditorGUILayout.BeginHorizontal(); if (_prefabScripts[0].prefabPrototype.meshRenderersDisabled) { GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.enableMeshRenderers, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { foreach (GPUInstancerPrefab prefabScript in _prefabScripts) { if (prefabScript != null && prefabScript.prefabPrototype != null) { GPUInstancerPrefabManagerEditor.SetRenderersEnabled(prefabScript.prefabPrototype, true); } } }); } //if (!_prefabScripts[0].prefabPrototype.meshRenderersDisabled) //{ // GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.disableMeshRenderers, Color.red, Color.white, FontStyle.Bold, Rect.zero, // () => // { // if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_disableMeshRenderers, GPUInstancerEditorConstants.TEXT_disableMeshRenderersAreYouSure, "Yes", "No")) // { // foreach (GPUInstancerPrefab prefabScript in _prefabScripts) // { // if (prefabScript != null && prefabScript.prefabPrototype != null) // { // GPUInstancerPrefabManagerEditor.SetRenderersEnabled(prefabScript.prefabPrototype, false); // } // } // } // }); //} EditorGUILayout.EndHorizontal(); } } } }
void OnGUI() { if (helpIcon == null) { helpIcon = Resources.Load <Texture2D>(GPUInstancerConstants.EDITOR_TEXTURES_PATH + GPUInstancerEditorConstants.HELP_ICON); } if (helpIconActive == null) { helpIconActive = Resources.Load <Texture2D>(GPUInstancerConstants.EDITOR_TEXTURES_PATH + GPUInstancerEditorConstants.HELP_ICON_ACTIVE); } if (prefabList == null || prefabList.Count == 0) { this.Close(); } EditorGUILayout.BeginHorizontal(GPUInstancerEditorConstants.Styles.box); EditorGUILayout.LabelField(GPUInstancerEditorConstants.GPUI_VERSION, GPUInstancerEditorConstants.Styles.boldLabel); GUILayout.FlexibleSpace(); GPUInstancerEditor.DrawWikiButton(GUILayoutUtility.GetRect(40, 20), "#Scene_Prefab_Importer"); GUILayout.Space(10); DrawHelpButton(GUILayoutUtility.GetRect(20, 20), showHelpText); EditorGUILayout.EndHorizontal(); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prefabImporterIntro, true); EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GUILayout.Space(5); EditorGUILayout.BeginHorizontal(); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.importSelectedPrefabs, GPUInstancerEditorConstants.Colors.green, Color.white, FontStyle.Bold, Rect.zero, () => { List <GameObject> selectedPrefabs = new List <GameObject>(); for (int i = 0; i < prefabList.Count; i++) { if (isEnabledArray[i]) { selectedPrefabs.Add(prefabList[i]); } } if (selectedPrefabs.Count > 0) { GameObject go = new GameObject("GPUI Prefab Manager"); GPUInstancerPrefabManager prefabManager = go.AddComponent <GPUInstancerPrefabManager>(); selectedPrefabs.ForEach(p => prefabManager.AddPickerObject(p)); this.Close(); Selection.activeGameObject = go; } else { EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_info, GPUInstancerEditorConstants.TEXT_noPrefabInstanceSelected, GPUInstancerEditorConstants.TEXT_close); } }); GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.cancel, Color.red, Color.white, FontStyle.Bold, Rect.zero, () => { this.Close(); }); EditorGUILayout.EndHorizontal(); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prefabImporterImportCancel); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Select All")) { for (int i = 0; i < prefabList.Count; i++) { isEnabledArray[i] = true; } } if (GUILayout.Button("Select None")) { for (int i = 0; i < prefabList.Count; i++) { isEnabledArray[i] = false; } } EditorGUILayout.EndHorizontal(); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prefabImporterSelectAllNone); EditorGUILayout.BeginHorizontal(); instanceCountToSelect = EditorGUILayout.IntSlider(instanceCountToSelect, 0, maxInstanceCount); if (GUILayout.Button("Select Min. Instance Count")) { for (int i = 0; i < prefabList.Count; i++) { isEnabledArray[i] = instanceCountToSelect <= instanceCountArray[i]; } } EditorGUILayout.EndHorizontal(); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prefabImporterSelectOverCount); GUILayout.Space(5); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box); GUILayout.Space(5); GPUInstancerEditorConstants.DrawCustomLabel("Prefab Instances", GPUInstancerEditorConstants.Styles.boldLabel); DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_prefabImporterInstanceList); GUILayout.Space(5); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.BeginVertical(); if (prefabList != null) { for (int i = 0; i < prefabList.Count; i++) { isEnabledArray[i] = EditorGUILayout.BeginToggleGroup(prefabList[i].name + " (Instance Count: " + instanceCountArray[i] + ")", isEnabledArray[i]); EditorGUILayout.EndToggleGroup(); } } EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); //GameObject go = new GameObject("GPUI Prefab Manager"); //GPUInstancerPrefabManager prefabManager = go.AddComponent<GPUInstancerPrefabManager>(); //Selection.activeGameObject = go; }