Search Unity

Unity UI Sceneview and gameview show the same thing but the build screws it all up?

Discussion in 'UGUI & TextMesh Pro' started by tavichh, Aug 13, 2017.

  1. tavichh

    tavichh

    Joined:
    Jul 7, 2012
    Posts:
    43
    Hello!
    So I'm having an interesting problem. I'm trying to get the scene of the game stretch accordingly to the canvas which is rendered in world space.

    Here is my game view in the editor.
    As you can see, the canvas aligns perfectly with the camera.
    Now, here is my game view.
    The UI is cut off due to the camera's ratio being 16:9 instead of 4:3.
    Most people now have 16:9 ratio monitors so this is quite an issue.
    Here is the game view when in 4:3
    The UI is stretched to the edge of the screen as designed in the scene.

    How can I make the UI stretch appropriately from people's aspect ratios?
     
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    You need to set your anchors appropriately. Either set to stretch (outside of the screen) so it stays a fixed size, or anchored to a specific portion of the screen (stretch based on that region).

    Best to watch the UI Learn videos to get a feel for them (there are also some good Live sessions on this)

    Hope that helps.