22
2015
Increase Terrain Detail Draw Distance in Editor

Its quite annoying how the grass fades in editor (since 250 is the maximum view distance in Terrain settings),
but you can force the draw distance higher with simple script whichs runs in editor
References:
http://docs.unity3d.com/ScriptReference/Terrain-detailObjectDistance.html
http://docs.unity3d.com/ScriptReference/ExecuteInEditMode.html
Sample code: *Note this runs with Update loop so you can adjust the public variable “distance”, but usually just setting it once is enough..
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; | |
| } | |
| } |
Related Posts
Leave a comment
Recent posts
- Adding Real World Location to Ice Fishing Prototype
- [web tool] Image Channel Inspector : AlphaScope
- Editor Tool: Smart Recompile (don’t recompile if edit comments)
- Editor Tool: Scene Size Analyzer
- LudumDare 60: Old Tech
- uBasic Scripting Language for Unity
- GreaseMonkey+Editor Plugin: 1-Click Copy script from ChatGPT (Web) to Unity Editor (as script)
- Editor Tool: Property Watcher
- .unityignore : Hide files from Project window
- PostBuild Script to Create Single exe Standalone File
- Game Loop Designer
- Favorites in PackageManager
Recent Comments
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by











