Can't center the scene ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MoonLightKnight

I have few scenes in my project. I was able to center all of the other scenes. But i cannot center the main scene in my project. Its fine when it opened on a mobile device(probably because resolution matches i guess). but when i opened it in tablet(its an old tab “xiaomi tab 3”) its always align to the right on the screen. I was able to center other scenes but i cant center the main scene to screen for some reason. project setting set as 2D and Expand. I also tried to use Control nod, canves layers, margine containers… but nothing works.


Also I tried to add the main scene as a child of one of the scenes that centered correctly. But it still didn’t work. So my last guess was, it supposed to something wrong with the camera2d nod .My camera was inside the player scene, so I removed the camera from PLAYER SCENE and added it to the MainSCENE but still it didn’t work. Then i delete the camera, surprisingly it work perfectly without problems. So it happens because of the camera…(i have no idea why thought). my scene resolution is 1920x 1080 . but with camera movement it have 1920+320 in the background(when player move on y axis ,bg also moves). I can add offset to camera can correct it in the tab view, but then its wrong on mobile device. So i might need to move scene without a camera i guess

If someone can give any suggestions, Thank you

:bust_in_silhouette: Reply From: Drawsi

Get the viewport display size and half it. Make sure that the scene has the center point in the right position. Then just say position = viewportdisplay.size.x / 2