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
- Favorites in PackageManager
- LudumDare59 : Signal
- Unity Editor: Tree Generator
- Leaf/Foliage Generator Tools (Runs in Browser)
- Testing Unity AI Beta
- Ways to Support UnityCoder Development
- Using UI Slider to Create 5-Star Rating Element
- Game Music Library For Unity (editor plugin)
- Fontastic : Easily Test Fonts in Unity Editor!
- GeoTiff Importer & Terrain Generator for Unity
- Create Baked DropShadow for UI images
- .JP2 Ortho Image Converter to PNG/JPG/TIFF
Recent Comments
- on Mesh Exploder (sources)
- on Sprite Sheet Flip Book Shader
- on Sprite Sheet Flip Book Shader
- on [Asset Store] PolygonCollider2D Optimizer
- on Trajectory Test Scene 2.0
- on Vector3 maths for dummies!
- on UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns
- on Using RenderDoc with Unity (graphics debugger)
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by











