Answer the question
In order to leave comments, you need to log in
How to change max size of texture in unity via script?
Hello, I had a need to change the value of the size (max size) of the textures through the script:
or change the number of repetitions of the texture of the terrain, also through the script:
Please tell me how to do this? If at all possible.
Answer the question
In order to leave comments, you need to log in
Texture settings can only be changed in the editor using the TextureImporter . Call AssetImporter.GetAtPath on the desired file and get the importer, then change maxTextureSize and save with AssetImporter.SaveAndReimport .
Terrain was written a long time ago and has not been updated since then, so editing it from a script is quite expensive. If nothing was found in the public API, then, most likely, this is done only through reflection and crutches. You can read the source code on github , maybe you will find something suitable.
UPD: Found something similar that might work. Get Terrain.terrainData , it has splatPrototypes, apparently, these are brushes. I think if you twist SplatPrototype.tileSize , you can get the desired result.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question