CreateTerrain.cs 431 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using System.Collections;
  3. using TerrainComposer2;
  4. [ExecuteInEditMode]
  5. public class CreateTerrain : MonoBehaviour {
  6. public bool createTerrain;
  7. void Update()
  8. {
  9. if (createTerrain)
  10. {
  11. createTerrain = false;
  12. CreateTerrains();
  13. }
  14. }
  15. void CreateTerrains()
  16. {
  17. TC_Area2D area2D = TC_Area2D.current;
  18. if (area2D == null)
  19. {
  20. return;
  21. }
  22. area2D.terrainAreas[0].CreateTerrains();
  23. }
  24. }