Hi, I’m trying to set the position of an overlay UI element dynamically through code.
Here’s what I was attempting:
ecs.Ui.set(world, component.eid, {
type: 'overlay',
background: '#FFFFFF',
text: 'This is in final score script',
left: '50%',
top: '50%',
width: '100%',
height: '100%',
})
I want to use percentages (like 50% for left and top) so that the element is responsive across different screen sizes. However, it doesn’t seem to apply the positioning as expected.
Is there a way to properly set the position of an overlay UI element using percentages in ECS? Or should I be using a different approach?
Thanks!