Rasagar/Assets/TerrainDemoScene_URP/Scripts/TerrainTreeToggle.cs
2024-08-26 23:07:20 +03:00

27 lines
606 B
C#

using UnityEngine;
public class TerrainTreeToggle : MonoBehaviour
{
private void OnEnable()
{
var terrains = Object.FindObjectsOfType<Terrain>();
foreach (Terrain terrain in terrains)
{
terrain.drawTreesAndFoliage = false;
}
RenderSettings.fogDensity = (float)0.0001;
}
private void OnDisable()
{
var terrains = Object.FindObjectsOfType<Terrain>();
foreach (Terrain terrain in terrains)
{
terrain.drawTreesAndFoliage = true;
}
RenderSettings.fogDensity = (float)0.0005;
}
}