Search Unity

[2D] Ways to support multiple resolutions other than Canvas.

Discussion in 'General Discussion' started by tinycarnival, Jan 27, 2020.

  1. tinycarnival

    tinycarnival

    Joined:
    May 9, 2018
    Posts:
    5
    What would be the best way to support multiple portrait aspect ratios for your game elements without having the need to use canvas? I have been browsing the forums and have learnt that using canvas could impact the overall performance of your game. Could anyone point me out to the right direction?

    Just an additional info. I need to use it for the game elements, backgrounds, characters and such and not for UI elements.
     
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,139
    See how your idea works on the platforms you're targeting before dismissing it. This is premature optimization at this point.
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,145
    Yes, but this applies to absolutely everything. A poorly written script can cause performance impacts just as easily as using canvases inappropriately, and worse yet what you think may be better performing may not be better performing which is why you shouldn't be worrying about this until you do run into a case where it doesn't perform as desired.

    That said there is one general rule of thumb that can assist you that knowing about it ahead of time can save you time down the road. Unity's canvases update themselves whenever a component changes, and only the canvas that the component is on.

    What this means from a performance perspective is that you should always separate static components from dynamic components. Furthermore if one of the aspects of your game will be very complex with many subcomponents then that should be on its own canvas too. Use them liberally.

    For more information I highly recommend the following video by Unity's Enterprise Support team. The URL should position the video at the start of the talk that deals with the UI (23:29), but I do recommend watching the entire thing.

     
    angrypenguin and iamthwee like this.