How do i adjust terrain texture sizes via script

hi all

I’d like to know how to adjust these X and Y size parameters from a script, at runtime:

alt text

I’m also interested in any information/opinions/techniques/anecdotes regarding doing this, and any information about the performance costs.

  1. Click on the Texture asset in your Project folder
  2. In the Inspector, make Texture Type “Advanced”
  3. Check “Read/Write Enabled”
  4. Click “Apply”
  5. Repeat this for all your Terrain textures!
  6. Write C# Script on your Terrain GameObject:

This example changes all x,y Terrain map tileSizes to 100

Terrain terrain=GetComponent<Terrain>();
float newTileSize=100f;

SplatPrototype[] splats=new SplatPrototype[terrain.terrainData.splatPrototypes.Length];
for(int i=0;i<terrain.terrainData.splatPrototypes.Length;i++){
	SplatPrototype splat=terrain.terrainData.splatPrototypes*;*

_ splats = new SplatPrototype();_
_ splats*.texture = splat.texture;
splats.tileOffset = splat.tileOffset;
splats.tileSize = new Vector2(newTileSize, newTileSize);
splats.texture.Apply(true);
}*

terrain.terrainData.splatPrototypes=splats;
Happy Terrain Coding! =oD
Martian Games_