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 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
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on