UI Element Moving On Play For Unknown Reason

Hey there,

I’ve got a curious case of an UI element moving for a reason I can’t figure out.
The element doesn’t have any scripts attached to it and no other scripts are present in the scene that have any references to the element. Also, the only parent of the element are the root and 2D Screen objects.

Yet, the element still gets a visible offset in comparison to the way it appears in the editor, once the scene is launched. I logged its position to the console, but it’s returning the same value as the one that appears in the editor.

Can anyone please tell me if I’m missing something here or is this indeed an error? Thank you.

A picture that shows how the scene looks before it is launched:

Sounds like it could be an anchoring setup issue. How are the grey boxes anchored?

The left grey box ( the one that moves when the scene is launched) is the object that’s highlighted in the hierarchy. You can see from the 2nd picture I posted that the anchor values on it are (0,0,0,0).
Is that what you were asking, or ?

Can you post a link to the project please? My guess that the blue box and grey box is anchored differently to each other


Here it is.

Looks like an anchoring problem.

The Sentence Button 1 is anchored to the top left and the position is relative to that anchor.


DraggableButtons is anchored to the middle of the screen.


If you change the size of the launch window, you can see how the anchoring affects the screen position of each element.

I’ve changed the anchor values on the Sentence Button 1 to (0.5, 0.5, 0.5, 0.5), but now instead of the position being offset, the size of the button changes.

I guess I just don’t quite understand how anchors affect element position/size then… think you could just briefly explain why the size changes?

Your best bet is to check the documentation here: https://developer.playcanvas.com/en/user-manual/user-interface/elements/

eg: https://playcanvas.com/editor/scene/812380

I checked the documentation but I still don’t understand what the value causing the size change that I started experiencing now could be.

The values on Sentence Button 1 that I have in my scene now are equal to the ones in the scene you linked.

Also, in my scene, Sentence Button 1 and Sentence Button 2 are almost identical to each other and by looking at them in the inspector I can’t pin-point any value that would cause such a change. Yet, Sentence Button 1’s size changes and Sentence Button 2’s doesn’t. And even if I make them swap positions, the Sentence Button 1 is still affected by the size change and the Sentence Button 2 isn’t.

Their status, as far as parent/child entity relationships go, are the same and their anchor values are also equal, just like their pivots. Is there some other setting I’m missing here?

I’m not sure I’m understanding your problem? I’ve re forked the project and neither the buttons change size?

I’ve closed the project now and re-opened it and then the size change was visible in the editor. I just changed it and now everything’s working the way it’s supposed to.

I tried changing the value before closing the project but I was still getting the unexplained size change when launching the scene.

Not sure what happened here but thanks for the replies. I guess it was just some kind of internal error with the editor.