GUI: keeping element positions on window resize

Im making a fullscreen / resizable game and need to keep the elements in place (life, currency displayers on the top corners, healthbar on the bottom etc)

I guess I need to listen to a “onResize” event, get the screen size, then manually reposition the elements to where I want them? if so what’s the event I should be listening to?

Im playing around with auto resolution, blend scales for the 2D screen and so on but doing circles around this. Any tips?

Thanks
Yohami

1 Like

Are you using the anchors in the UI elements to position an element to an edge or a corner?

https://developer.playcanvas.com/en/user-manual/user-interface/elements/

Thanks, that helped. Is there an event I can listen to know when the window has been resized? or do I need to check on update?

I have some floating elements that need to re-arrange as well

Found it

1 Like

This helped too - needed to take in account the scaling of the screen. So many moving parts