How to change image by resolution?

My game will support HD, FHD, QHD, and UHD for resolution. The designer gives me the same images with different sizes for each resolution. I want to give a different image when the user changes the resolution. How can I do it? I have the following ideas but they don’t work well.

  1. Make a prefab for each resolution and change it when the user changes the resolution.
    → I should find the corresponding prefab and Instantiate it with the same transform or parent. It might not work well.
  2. Make a sprite atlas for each resolution and change it when the user changes the resolution.
    → Putting all sprites for UHD in one sprite atlas is too big. If I make many sprite atlas for each resolution, it is hard to track which sprite atlas should I load and unload.

If it’s just sprites I’d probably try a Variant Sprite Atlas with different scales. I haven’t really tried it before but based on this workflow it sounds like you can swap what atlas to use with late binding.

1 Like