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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Question Button element not exactly where it is expected in game mode

Discussion in 'UI Toolkit' started by MacStanley, Jan 4, 2022.

  1. MacStanley

    MacStanley

    Joined:
    Jul 18, 2013
    Posts:
    118
    Hey there,

    I have some kind of table where ingame I have multiple rows. In the UI Builder one row looks like this:

    upload_2022-1-4_19-56-36.png

    But in the editors game window it looks like this (the green rectangle is inserted to help you see that the X button is way up):
    upload_2022-1-4_19-58-53.png

    I am not able to get it exactly where it should be. The Margin & Padding values are 0, for all elements. The size of the button is 25x25px. The Labels have a size of 200x25px.
     
  2. uBenoitA

    uBenoitA

    Unity Technologies

    Joined:
    Apr 15, 2020
    Posts:
    198
    Can you see in the UI Debugger if the button's size (or other layout measurements) are what they are supposed to be? It would be easier to help if we could pinpoint exactly what value is being wrong. Also another thing to keep in mind is that the default styles in runtime are not always identical to those of the rest of the editor, and the UI Builder might be displaying your UI with the editor styles, by default. (At the top-right of the Viewport, there should be a dropdown where you can select what style to apply when viewing)
     
  3. MacStanley

    MacStanley

    Joined:
    Jul 18, 2013
    Posts:
    118
    I've found the UI Toolkit Debugger, but unfortunately I wasn't very successful using it. Is there any guide for it? Couldn't find one on YouTube.