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

Unity UI Best strategy to handle UI scale/sizing for a game that is PC and Mobile

Discussion in 'UGUI & TextMesh Pro' started by QuantumCalzone, May 27, 2022.

  1. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Hi there, I was wondering if anyone had an insight on what is a good solution for tackling UI sizes on a project that will be built for both standalone platforms (PC, Mac) and mobile (iOS, Android).

    Using the Canvas Scaler with a UI Scale Mode of Constant Pixel Size doesn't work well since this project will run on many different resolutions and pixel densities.

    Using the Canvas Scaler with a UI Scale Mode of Scale With Screen Size works well for PCs but the UI becomes incredibly small when applied to mobile.

    Using a Canvas Scaler with a UI Scale Mode of Constant Physical; Size works great well for Mobile, would it also be good for PC? I can't think of a reason why but I just haven't seen many devs apply that strategy online.

    Right now my solution is to make helper classes that can save pertinent UI info for PC and Mobile. For example, a class that will save/apply RectTransform values for standalone and mobile. It works for now but it's a bit of a pain and I'm curious if there is a better strategy I'm not aware of.

    Thank you for your time!