terrain trees random rotation doesn't work

hi all!
I’ve noticed that using the terrain and the trees placement with the random tree rotation the trees are placed all with no rotation…
the strange thing is that I do this script:

GameObject go = Selection.activeGameObject;
var terrain = go.GetComponent<Terrain>();
for (int i = 0; i < terrain.terrainData.treeInstances.Length; i++)
{
    Debug.Log("Rotation: "  + terrain.terrainData.treeInstances[i].rotation.ToString());   
    terrain.terrainData.treeInstances[i].rotation = 0.0f;
    Debug.Log("New Rotation: "  + terrain.terrainData.treeInstances[i].rotation.ToString());
}

the log tell me that the rotation is effectively randomized, but the 3d is still not rotated…
the line where is set the rotation to zero doesn’t work

thanks!

I’m having a similar issue - I’m creating a terrain in c# scripts and adding trees to it, and setting TreeInstance.rotation to random values, but all the trees are drawn with the same rotation. The documentation says it’s in radians, I thought maybe there was a mistake and tried degrees but that doesn’t help.

Does this happen to everyone else? Any idea how to fix it? Is it a bug in Unity? Should I report it?

seems that works only with speedtree trees, noway for custom trees

Yeah I figured it out in the end. Really frustrating as it makes the Unity custom tree creator basically useless.