Unity UI Toolkit Window Placement on Visibility Change

Hello,

I’m creating a prototype for an RPG game and I decided to try using the UI Toolkit to make a pause menu. I’m not used to using UI toolkit so I think I’m doing something wrong but I’m not sure what. I built a UI document that shows up how I want it to when I play the game, but I’m not sure what I need to do to hide it and get it to show back up correctly again. I’ve tried turning the visibility off for a screen Visual Element, but when I turn the visibility back on with a UI manager script it just shows up incorrectly.

Any help on the subject would be great, and please let me know if any additional info would help.

Here’s what I get when I start my game and pause. I’m using these statements to make the “screen” Visual Element visible:

 screen.style.display = DisplayStyle.Flex;
screen.style.visibility = Visibility.Visible;

When I just set the screen visual element to visible this is what I get, and this is what I’m trying to go for when I press the pause button, but when I use code I get the result from the post above.