x


Refreshing tree data at runtime

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?

more ▼

asked Jan 14 '10 at 11:39 AM

Joe Robins gravatar image

Joe Robins ♦♦
182 4 7 11

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

There's a specific function to refresh the tree prototypes (and I'm you should also call Flush afterwards).

terrainData.RefreshPrototypes();
terrain.Flush();

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.

more ▼

answered Jan 14 '10 at 12:31 PM

duck gravatar image

duck ♦♦
45.7k 109 164 426

(comments are locked)
10|3000 characters needed characters left

I think the undocumented method Terrain.Flush() should work for this.

more ▼

answered Jan 14 '10 at 11:56 AM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
10.3k 9 27 108

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2103
x326

asked: Jan 14 '10 at 11:39 AM

Seen: 2176 times

Last Updated: Jan 14 '10 at 11:39 AM