Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Setting splatmap resolution during runtime (control texture resolution)

Discussion in 'Scripting' started by miniduck, Mar 5, 2013.

  1. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    Hi all,

    I cannot find a way of setting the resolution of the splatmap through script. (control texture resolution)
    I tried initializing a float array upon starting the game but the terrain only accepts what has been set in editor.

    Any ideas?

    Thanks!

    Code (csharp):
    1. // control texture res set to 1024 or 256 in ui
    2.  
    3. float[,,] splatMapData = new float[512, 512, 3];
    4. terrain_trn.terrainData.SetAlphamaps(0,0, splatMapData); // either remains at 1024 or out of bounds
     
  2. element_wsc

    element_wsc

    Joined:
    Jul 27, 2012
    Posts:
    522
unityunity