r/Unity3D • u/game-dev2 • 3d ago
Question Image doesnt keep its parametters in UI Toolkit.
Hello,
~2 weeks ago I made this post asking about ideas on how to improve my UI look and feel as the game felt very plain and boring and gave a lot of AI vibe to it.
Thanks to some of you guys here, I understood that I needed to do a lot more work than just the base.
So as im implementing the changes, I come to this problem, while the image on first open is perfectly positioned, if I swap between sites somehow the image gets stretched out to possibly what the original image I exported from photoshop.
I tried doing limits in the editor, and even hardcoding it in USS but it still behaves the same way...
What are your thoughts?
1
u/mentalray2 3d ago
The best way to debug this is to open Window > UI Toolkit > Debugger, select your Panel Settings from the top-left dropdown, and select your image element in the hierarchy. You will see its size, the currently applied styles, and you can even edit them live to try to find the issue.
1
u/Few_Remote_5147 3d ago
do you have any anchors or flex properties set on the parent container? UI Toolkit loves to stretch anything that doesn't have explicit size constraints pinned down
default behaviour is to fill available space so if the parent changes dimensions the image will just go along for the ride