using UnityEditor; using UnityEngine; using System.Collections; namespace TTT { public class ClearWaterLevel : ScriptableWizard { public Terrain terrain; public Transform waterPlane; [MenuItem ("Window/Terrain Tools/Clear below water Level",false,109)] static void CreateWizard () { ScriptableWizard.DisplayWizard("Clear now", "Apply"); } void OnWizardCreate () { if(terrain==null || waterPlane==null) return; Undo.RecordObject(terrain.terrainData, "Clear below water level"); // remove trees ArrayList NewTrees = new ArrayList(terrain.terrainData.treeInstances); for (int i = NewTrees.Count-1; i >= 0; i--) { TreeInstance MyTree = (TreeInstance)NewTrees[i]; if (MyTree.position.y