So as you can see in my example all of the trees that I have are facing one direction which id like to be able to change the rotation so that it will seem more natural, any way of doing this instead of having to create seperate prefabs with different rotations for each tree? Thanks
If your underground is of type terrain you can add your trees to the tree painter and use the mass place trees function with random rotation checked.
Alternatively you can make an editor script that searches for all the trees in your current scene and applies a random rotation to it when you click “rotate” in the newly added “Trees” menu:
[MenuItem("Trees/rotate")]
public static void RotateTrees()
{
foreach (<T> tree in FindObjectsOfType<T>())
{
//for every found tree get the transform fo the gameobject and set its Y rotation to a
//random value beween 0 and 360 degrees (up to 2 decimals)
tree.gameObject.transform.localEulerAngles = new Vector3(0, Random.Range(0f, 360f), 0);
}
}
where in FindObjectsOfType has to be replaced by a component only your tree has (maybe a script called tree or something). Alternatively you can also search by name or tag, whatever floats your boat