ZMWSLI0-SL2021-GR11/Projekt/MWSProjekt/Library/PackageCache/com.unity.terrain-tools@3.0.2-preview.3/Runtime/TerrainToolbox/TerrainGroup.cs

30 lines
622 B
C#
Raw Permalink Normal View History

2021-07-05 21:20:56 +02:00
using UnityEngine;
[System.Serializable]
public class TerrainGroup : MonoBehaviour
{
public int GroupID = 0;
public void UpdateChildTerrains()
{
Terrain[] childTerrains = GetComponentsInChildren<Terrain>();
foreach (Terrain terrain in childTerrains)
{
GameObject existingGameObject = terrain.gameObject;
terrain.groupingID = GroupID;
}
}
public void DestroyChildTerrains()
{
Terrain[] childTerrains = GetComponentsInChildren<Terrain>();
foreach (Terrain terrain in childTerrains)
{
GameObject existingGameObject = terrain.gameObject;
DestroyImmediate(existingGameObject);
}
}
}