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 [SOLVED] After updating to 2022, why does my UI always look like this on launch?

Discussion in 'Editor & General Support' started by FusionScott, Jul 11, 2023.

  1. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    For some reason when I first open my project my UI looks like this. If I run it once then stop it, the UI goes back to normal. If I close Unity and reopen, it goes back to the weird view with the red X's. Ideas?

    upload_2023-7-11_10-4-2.png

    upload_2023-7-11_10-4-11.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,707
    Red X is usually just anchoring errors that have turned a RectTransform inside out.

    Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:

    https://forum.unity.com/threads/inc...size-between-two-people.1130146/#post-7261747

    https://forum.unity.com/threads/game-ui-button-size-problem.1142650/#post-7337383

    Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.

    I also use this
    CanvasScalerOrientationDriver
    utility to make sharing UI for Landscape / Portrait easier. Read what it does carefully.

    https://gist.github.com/kurtdekker/8802b1b6c708637398f8c9167641efd3
     
  3. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    This has just gotten worse. And now I'm getting this error over and over until I run and stop again. I don't see anything that would be "inside out". I don't even know what ScaleMode or MatchMode are so I'm pretty sure I haven't changed that. I'm not using portrait, this is only a desktop app.


    Assertion failed on expression: 'IsFinite(distanceForSort)'


    upload_2023-7-18_13-57-21.png
     
  4. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    I found the Canvas Scaler on both the canvases in my scene. Both are set to "Contstant Pixel Size".
     
  5. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    Here are the properties for both canvases in my scene.

    upload_2023-7-18_14-1-30.png
     
  6. msfredb7

    msfredb7

    Joined:
    Nov 1, 2012
    Posts:
    143
    Which version of Unity are you on? You can try updating to 2022.3.5f1. I know there were some UI-related fixes.
     
  7. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    So there are two things happening.

    1. The canvas size is 0,0 when I launch Unity. In addition to running the project, I can also simply switch to the "Game" tab. Once this is done, the canvas size is correct.
    2. Some properties are reverting when I close and reopen Unity.

    This seems to be a Unity bug. It is reproducible. Here is a video of the issue:
     
  8. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    Thank you. Downloading now.
     
  9. FusionScott

    FusionScott

    Joined:
    Sep 2, 2020
    Posts:
    15
    Updating to 2022.3.5f1 fixed the problem immediately.