I’m creating an inspector window and it seams that foldouts are not aligning properly.
in the UI Builder the foldout arrow is aligned with the line above above, but in the actual inspector it goes to the left of the line, same with the Channels foldouts.
Any ideas what is happening here?
the first image is from the UI Builder:

The second is from the actual inspector:

It looks like the UI Builder does not have the indentation. The Inspector adds some padding to the edges which will cause the elements to move from the left a little, you will need to adjust to account for this.
Try using the UI Toolkit debugger, it will give you information about why it looks the way it does, in this case the padding.
Seams like unity-foldout__toggle–inspector is adding a left margin of -12
It does this on all foldouts in this inspector, both the vanilla one, and the one I have as a custom element
The padding of the inspector is ok with a 15 px padding on the left
so it looks like its a built in behavior, I added this class .unity-foldout__toggle--inspector
just for curiosity and it addes a -12 px margin to the foldout.

1 Like