Search Unity

How Can I change the Resolution of my Character's Texture in Game ?

Discussion in 'General Graphics' started by FGPArthurVII, May 7, 2016.

  1. FGPArthurVII

    FGPArthurVII

    Joined:
    Jan 5, 2015
    Posts:
    106
    Hello. I have a character with 4K sized texture square, I'm going to make 2K and 1024 versions of it as well, wich can be changed in the options menu. The player can choose low character resolution(1024p), medium (2048p [HD]) or High (4096p [4K]) but how can I do that, what is the code to change the textures?

    Thanks,
    Arthur
     
  2. TheAlmightyPixel

    TheAlmightyPixel

    Joined:
    Jun 21, 2014
    Posts:
    263
    If you only want to change the resolution of the player's texture, you could create a new Texture2D (essentially a clone of your player's texture) during runtime and use Texture.Resize to scale the texture down. After you've scaled it down, you can assign it as the new texture of the material your character uses.

    If you want to change the resolution of every texture in your level, you could use QualitySettings.masterTextureLimit Changing the texture limit changes the resolution of every single texture in your game to the resolution of one of their mipmaps (you might want to look at the docs, I don't really know how I could explain it)

    Hope this helps,
    TAP