public void Generate() { if (executing) { executing = false; data.ApplyTexture(); data.CalculateLODS(); return; } if (data.IsOkay) { data.Init(); data.ApplyTerrainToTexture(); executing = true; Debug.Log(executing? "generating": "stopping generating"); } else { Debug.Log("No terrain data"); } }