public override void OnInspectorGUI() { Undo.RecordObject(Target, Target.name); if (Utility.GUIButton("Generate", UltiDraw.DarkGrey, UltiDraw.White)) { Target.Generate(); } Target.Combine = EditorGUILayout.Toggle("Combine Meshes", Target.Combine); Target.Optimise = EditorGUILayout.Toggle("Optimise", Target.Optimise); Target.Resolution = Mathf.Clamp(EditorGUILayout.IntField("Resolution", Target.Resolution), 1, 50); EditorGUILayout.HelpBox("Colliders: " + Target.GetColliders().Length, MessageType.None); EditorGUILayout.HelpBox("Bounds Min: " + Target.BoundsMin.ToString("F3"), MessageType.None); EditorGUILayout.HelpBox("Bounds Max: " + Target.BoundsMax.ToString("F3"), MessageType.None); EditorGUILayout.HelpBox("Bounds: " + Target.GetExtents().ToString("F3"), MessageType.None); if (Utility.GUIButton("Show Bounds", Target.ShowBounds ? UltiDraw.Cyan : UltiDraw.Grey, UltiDraw.Black)) { Target.ShowBounds = !Target.ShowBounds; } if (Utility.GUIButton("Show Geometry", Target.ShowGeometry ? UltiDraw.Cyan : UltiDraw.Grey, UltiDraw.Black)) { Target.ShowGeometry = !Target.ShowGeometry; } if (GUI.changed) { EditorUtility.SetDirty(Target); } }
void Awake() { Target = (VoxelCollider)target; Target.GetColliders().gameObject.hideFlags = HideFlags.None; }