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 Red Xs instead of UI

Discussion in 'Editor & General Support' started by Simplisticated_Development, Oct 6, 2023 at 1:30 AM.

  1. Simplisticated_Development

    Simplisticated_Development

    Joined:
    Jun 26, 2023
    Posts:
    57
    Hey everyone-

    I was making some UI in my Unity project and then when I turned on "Scale with screen size" the buttons just turned into red Xs for some reason! The buttons don't exist when you hit the play button. When I set the canvas to "constant pixel size", everything is okay again!

    Screenshot 2023-10-05 at 8.23.23 PM.png
    (UI when I set "scale with screen size".)

    Oddly enough, when I build, the UI is there, unlike in play mode. My main problem is that I kinda need to be able to see the buttons to move them.

    My online searches didn't show anything helpful.

    Thanks for answers in advance!
     
  2. ThatAccountBlaBlaBla

    ThatAccountBlaBlaBla

    Joined:
    Oct 25, 2017
    Posts:
    2
    Hello there,
    Could you provide a capture of the UI elements that have that happen(before and after)?Generally that red X shows when the size of a rect is negative in any axis. Did you set a value matching the Game window resolution you are using?
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,283
    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