Nez icon indicating copy to clipboard operation
Nez copied to clipboard

Center in UICanvas, reposition on window resize.

Open Oen44 opened this issue 4 years ago • 1 comments

Is there any build-in way to center UI.Element inside parent UI.Container? I know that I can use SetPosition to center it myself, however when client resizes window, position of that element doesn't change. There should be method CenterInParent() or something, that way anything in e.g. UICanvas will be centered even when window size changes.

Oen44 avatar Mar 12 '20 01:03 Oen44

You could check out if a UI.Table does what you need: https://github.com/prime31/Nez/blob/master/FAQs/UI.md

I played a bit with that example and the cells stay in the center of the screen (event after resize). The contents of the cells seem also to stay centered to their parent cells. image

Tobi-Mob avatar Oct 15 '21 08:10 Tobi-Mob