set terrain size via script

Hey community

I have a problem with setting terrain size via script.
example:

int width   = 1000;
int lenght  = 1000;
int height  = 600;

TerrainData.size = new Vector3(width, height, lenght);

this should give me a terrain with the given values… but when I select the created terrain in my scene and go to terrain/set Resolution it shows that my terrain is 600 in height, which is correct, 16000 in width/lenght !?

Anybody knows whats going wrong?

bump
anyone? :frowning:

I have a similar issue, did you ever figure out the problem/solution? My terrain always is flat, but when I modify it with the editor it does what it’s supposed to…

I scratched that project but I have it still on my hard drive…
It seems that dividing length and width by 16 gets the right results. Don´t ask me why :wink:

int width   = 1000;
int lenght  = 1000;
int height  = 600;

 TerrainData.size = new Vector3(width / 16f, height, lenght / 16f);