public override void OnInspectorGUI() { DrawDefaultInspector(); tar.height = Mathf.Clamp(tar.height, 0, Mathf.Infinity); tar.width = Mathf.Clamp(tar.width, 5, Mathf.Infinity); if (GUI.changed) { tar.CreateGround(); } GUILayout.Space(10); tar.smoothAll = EditorGUILayout.Toggle("Smooth Alwayes", tar.smoothAll); tar.smoothValue = EditorGUILayout.FloatField("Smooth Value", tar.smoothValue); if (GUILayout.Button("Smooth Curves")) { SmoothCurves(); } if (GUILayout.Button("Update All Zippy Grounds")) { ZippyTerrain2D[] z = FindObjectsOfType <ZippyTerrain2D>(); for (int i = 0; i < z.Length; i++) { z[i].CreateGround(); } } GUILayout.Space(10); EditorGUILayout.HelpBox("Shift key to delete point\nControl key to smooth point", MessageType.Info); EditorUtility.SetSelectedRenderState((target as ZippyTerrain2D).cacheMeshRenderer, EditorSelectedRenderState.Wireframe); }
private void OnEnable() { tar = (target as ZippyTerrain2D); Undo.undoRedoPerformed += UndoRedoPerformed; tar.Init(); tar.CreateGround(); }