Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

How to support UI scaling?

Discussion in 'Editor & General Support' started by col000r, May 23, 2019.

  1. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    662
    There's been support for adding a 2x texture to a GUIStyle for a long while now - and it's nice how all my old stuff continues to function without any changes - but how do I support UI scaling beyond 2x if I wanted to?
    And how do I support it when using UIElements?

    Is there any kind of documentation out about this yet?
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    133
    Hello,

    Right now there is no supported for scaling beyond @2x.

    Regarding UIElements, you can get the same behaviour as IMGUI using the "resource()" function in style sheets.

    If an image with a suffix @2x exists (for example: background@2x.png, it will be loaded when the window is displayed on a Retina screen, even if the property is "background-image: resource("background");

    See the "Assets" section of this page: https://docs.unity3d.com/2019.2/Documentation/Manual/UIE-USS-PropertyTypes.html

    Not this suffix does not work with the url() function, I will make that more explicit in the manual page.
     
unityunity