Search Unity

UI goes off center in gameview but not in sceneview

Discussion in 'UGUI & TextMesh Pro' started by JeffreyA, Oct 22, 2018.

  1. JeffreyA

    JeffreyA

    Joined:
    Jun 6, 2017
    Posts:
    17
    Hallo,

    I created a smartphone that players can use inside my game.
    The whole project is in 2d and uses UI elements.

    I have created a smartphone in UI elements, that spawns at (0,0,0).
    The screens are childs of the smartphone. And also spawn at (0,0,0), but they are slightly smaller than the smartphone, because it has edges. Just like a real smartphone.

    The strange thing is, when the game starts it moves the smartphone from (0,0,0) to (250,0,0). And accordingly to the positions, the screens also move. But when the moving is done, the screens are slightly off center (+- 4 units). The position of the screens are still (0,0,0), but in the game view they are shown as something like (-4, 0,0). Even stranger, the scene view shows them correct, in center.

    Does anyone know why this happens?
     
    Last edited: Oct 22, 2018
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096