Is it possible to set the terrain’s alphamap resolution via code? It’s easy to change via Unity’s Terrain menu, but for terrains created through code it always seems to be 512x512 with no way of changing it. Looking through the forums it looks like there used to be an “Init” function on TerrainData which allowed to set it, but that function no longer exists. Does anyone know?
–Eric
Thanks, but I saw both of those. Neither offers a way of changing the alpha map resolution.
–Eric
It’s a read-only property.
It doesn’t say read-only in the docs (because it’s not).
–Eric
Try changing it, you’ll get an error.
var newTerrain = new TerrainData();
newTerrain.alphamapResolution = 64;
Debug.Log (newTerrain.alphamapResolution);
No error.
–Eric
Crap, you’re right. I was trying to set alphamapWidth instead. Somehow I completely missed alphamapResolution. Thanks for your patience.
But is it possible to set alphamapWidth != alphamapHeight? If I set alphamapResolution then alphamapWidth = alphamapHeight = alphamapResolution.
No.
–Eric
Thanks So does it mean alphamapWidth always equals alphamapHeight? If it does, why don’t Unity just has 1 variable like: alphamapWidthHeight?
Because of reasons. Maybe they thought they’d add that capability later; who knows.
–Eric