Rasagar/Assets/TerrainDemoScene_URP/Scripts/TerrainTreeToggle.cs

27 lines
606 B
C#
Raw Permalink Normal View History

2024-08-26 13:07:20 -07:00
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;
}
}