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
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)
- UnityHub: Add support for custom project title (instead of folder name) or use ProductName
- Testing Unity MUSE AI
- QR Code Generator Online