Nez
Nez copied to clipboard
Center in UICanvas, reposition on window resize.
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.
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.