/// Called when the the editor reloads the script or when the action starts. void OnEnable() { EditorReference = null; mBoundary = new e2dTerrainBoundary(this); mFillMesh = new e2dTerrainFillMesh(this); mCurveMesh = new e2dTerrainCurveMesh(this); mGrassMesh = new e2dTerrainGrassMesh(this); mColliderMesh = new e2dTerrainColliderMesh(this); if (!mFillMesh.IsMeshValid() || (e2dUtils.DEBUG_REBUILD_ON_ENABLE && !Application.isPlaying)) { FixCurve(); FixBoundary(); RebuildAllMaterials(); RebuildAllMeshes(); } else { // make sure the curve control textures are ready CurveMesh.UpdateControlTextures(true); } }