Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Performance for changing resolution: Screen.SetResolution vs RenderTexture resolution

Discussion in 'General Graphics' started by spokdev, Aug 12, 2019.

  1. spokdev

    spokdev

    Joined:
    Dec 3, 2013
    Posts:
    6
    I`m trying different ways to change resolution in Android game.
    First is to use Screen.SetResolution:
    Code (CSharp):
    1. Screen.SetResolution(width, height, Screen.fullScreen);
    Second is to use RenderTexture like this:
    Code (CSharp):
    1. renderTexture = RenderTexture.GetTemporary(Mathf.RoundToInt(cam.pixelWidth * res), Mathf.RoundToInt(cam.pixelHeight * res));
    2. cam.targetTexture = renderTexture;
    I expect same performance with everything else equal, but in test scene using RenderTexture method takes 1-2ms more per frame.
    Is it by design and I should just make my peace with it?
    Why I would like to use RenderTexture method:
    - can render game in low resolution but render UI in full resolution
    - can change resolution dynamically (Screen method glitches for a portion of a second)
    - works correctly with android split screen (at least in my case)