Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Colors do not match UI Builder / USS variables

Discussion in 'UI Toolkit' started by spaceemotion, Apr 3, 2023.

  1. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    I am currently prototyping some screens with with UI Toolkit and noticed that the colors are totally different in the game and scene view when compared to the UI Builder. When compared to the raw hex values, the colors in the builder are correct and the scene and game views are the incorrect ones.

    Example 1:
    The background and icon colors are lighter and a kind of washed out.

    Screenshot 2023-04-04 004116.png

    Example 2 (top is gameview, bottom is the UI builder):
    Notice how the background image and the gradient overlay (just a simple texture) are being blended quite differently. The game view has a lot more contrast, where the UI builder has the proper 'overlay only' blending.

    Screenshot 2023-04-04 004554.png

    My scene only has the UIDocument component on a single game object, not even a camera.

    The project uses URP with HDR enabled, but changing those settings didn't change anything.
    The current editor version used is 2023.2.0a8.

    Is there a setting I am missing somewhere? Thanks in advance!
     
  2. mariandev

    mariandev

    Joined:
    Mar 30, 2013
    Posts:
    15
  3. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    Thanks for the link. I don't think I quite understand the reason for trying to switch to linear space in the UI Builder.

    The UI Builder shows the same colors as Figma or Photoshop, whereas the game view (using linear space) looks wrong. Would switching to a linear-based working for the UI mean that I would have to use different colors or pre-process the images so they match the reference files?

    I would love to simply use the same hex-values from my graphics apps in the USS files and let the engine work out the rest.

    Cheers!

    Edit: Apparently this has already been asked/requested in this thread: https://forum.unity.com/threads/uielements-runtime-with-different-color-spaces.823395/