public override void OnInspectorGUI() { meshCombiner = (MeshCombiner)target; serializedObject.Update(); DrawInspectorGUI(); serializedObject.ApplyModifiedProperties(); // DrawDefaultInspector(); if (!meshCombiner.combined && (meshCombiner.transform.position != meshCombiner.oldPosition || meshCombiner.transform.lossyScale != meshCombiner.oldScale)) { if (meshCombiner.octreeCreated) { // Debug.Log("Reset"); meshCombiner.ResetOctree(); } meshCombiner.oldPosition = meshCombiner.transform.position; meshCombiner.oldScale = meshCombiner.transform.localScale; } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Search")) { meshCombiner.AddToOctree(); SceneView.RepaintAll(); } Transform t = meshCombiner.transform; if (searchBoxSquare.boolValue) { Vector3 localScale = t.localScale; t.localScale = new Vector3(localScale.x, localScale.x, localScale.x); } if (!combineInRuntime.boolValue) { GUILayout.Space(10); if (GUILayout.Button("Combine")) { meshCombiner.CombineLods(); } } EditorGUILayout.EndHorizontal(); if (meshCombiner.octreeCreated) { DisplayOctreeInfo(); } GUIDraw.DrawSpacer(); if (meshCombiner.combinedList.Count > 0) { if (GUILayout.Button("Delete Combined Objects")) { meshCombiner.DestroyCombinedGameObjects(); } GUIDraw.DrawSpacer(); } }
void DrawOutputSettings(Color color) { GUI.color = color; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; GUIDraw.LabelWidthUnderline("Output Settings", 14); GUI.changed = false; int oldCellSize = cellSize.intValue; EditorGUILayout.PropertyField(cellSize); if (GUI.changed) { if (cellSize.intValue < 4) { cellSize.intValue = 4; } if (oldCellSize != cellSize.intValue) { if (meshCombiner.octreeCreated) { meshCombiner.ResetOctree(); } if (meshCombiner.combinedLODManager != null) { serializedObject.ApplyModifiedProperties(); meshCombiner.combinedLODManager.UpdateDistances(meshCombiner); } } } GUI.changed = false; EditorGUILayout.PropertyField(lodAmount); if (lodAmount.intValue < 1) { lodAmount.intValue = 1; } if (GUI.changed) { serializedObject.ApplyModifiedProperties(); if (lodAmount.intValue > 1) { meshCombiner.AddCombinedLODManager(); } else { meshCombiner.DestroyCombinedLODManager(); } } if (lodAmount.intValue > 1) { EditorGUILayout.PropertyField(lodSeachText); } EditorGUILayout.PropertyField(addMeshColliders); EditorGUILayout.PropertyField(useVertexOutputLimit); if (useVertexOutputLimit.boolValue) { EditorGUILayout.PropertyField(vertexOutputLimit); } if (vertexOutputLimit.intValue < 1) { vertexOutputLimit.intValue = 1; } //EditorGUILayout.PropertyField(removeGeometryBelowTerrain); //if (removeGeometryBelowTerrain.boolValue) //{ // DrawPropertyArray(terrains); //} EditorGUILayout.EndVertical(); }