I wrote a short script to change the texture of the tree model during the game runing, but all the trees I drawn with the brush tool can not refresh automatically, I need to click "refresh trees and detail prototypes" under the terrain tab to refresh and see the result, so how can I refresh the data in the script?
Answer by duck
Jan 14, 2010 at 12:31 PM
There's a specific function to refresh the tree prototypes (and I'm you should also call Flush afterwards).
Also note, because these commands are undocumented, they may be changed or removed entirely in future versions of unity, so bear this in mind - particularly if you're targetting the webplayer.
Answer by jonas echterhoff
Jan 14, 2010 at 11:56 AM
I think the undocumented method Terrain.Flush() should work for this.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
No one has followed this question yet.
Clearing the TreeInstance array removes all trees perminantly
Programatically placed trees end up in a wrong place
colliders moving in wind
How to add your own trees into Terrian editor?
Swap tree prefabs at runtime