Last active
September 21, 2015 21:10
-
-
Save unitycoder/79a986dcb810482c53af to your computer and use it in GitHub Desktop.
Force Terrain Details DrawDistance over the 250 limit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[ExecuteInEditMode] | |
public class ForceGrassDistanceInEditor : MonoBehaviour { | |
public float distance=250; // 250 is max in terrain settings, but not here | |
Terrain terrain; | |
void Start () { | |
terrain = GetComponent<Terrain>(); | |
if (terrain==null) | |
{ | |
Debug.LogError("This gameobject is not terrain, disabling forced details distance", gameObject); | |
this.enabled=false; | |
return; | |
} | |
} | |
// WARNING: this runs update loop inside editor, you dont need this if you dont change the value | |
void Update() | |
{ | |
terrain.detailObjectDistance = distance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment