Question by
alex-mircea121 · Jun 18, 2017 at 05:16 PM ·
unity 5editorterrain
HOW CAN I SET THE TERRAIN.TREE DISTANCE >2000? SEEMS TO BE IMPOSSIBLE!!
Hey, guys I'm on this for days now. It seems that you cannot change the Terrain.TreeDistance greater than 2000 EVEN WITH SCRIPTS!! Why is that?
Here is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class BasemapDistanceSet : MonoBehaviour
{
public float distanceToSet = 500000000;
void OnEnable()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.update += Set;
#endif
}
void Start()
{
Set();
}
void OnDisable()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.update -= Set;
#endif
}
void Update ()
{
Set();
}
void Set() {
var terrainScripts = GameObject.FindSceneObjectsOfType(typeof(Terrain));
foreach (var terrain in terrainScripts)
{
(terrain as Terrain).treeDistance = distanceToSet;
Debug.LogFormat("Setting {0}",terrain.name);
}
}
}
Comment
From the "ask a question" page instructions
Remember to…
Be polite. Typing questions and comments in all caps and using unnecessary punctuation (!!1! / ???) will not increase the likelihood of your question being answered.
Your answer
![](https://koobas.hobune.stream/wayback/20220612124422im_/https://answers.unity.com/themes/thub/images/avi.jpg)