PKey
PKey

Reputation: 3841

Camera wrong orientation?

I created an empty 2D project - to try a tutorial from here

https://codeplanstudio.com/tutorials/block-adventure-game-tutorial/

(episode 2).

  1. Added assets (graphics)

  2. created Canvas

  3. in the Canvas

    a. canvas rendering mode Screen Space Camera
    
    b. rendering camera set to Main Camera
    
    c. Canvas scaler: scale with screen size, Reference resolution set x:1920 y:1080, match 0.5
    
  4. added UI image to Canvas

  5. in image

    a. source image - an image from assets
    
    b. set native size (native size is width:1080 height:1920)
    

When I look at the scene, the camera has the same dimensions with the canvas, but inverted: what should have been height is width and what should have been width is height.

enter image description here

What I was expecting was this (as seen in a video tutorial):

enter image description here

Any suggestions?

Upvotes: 1

Views: 127

Answers (1)

derHugo
derHugo

Reputation: 90580

In your GameView on the top bar there is the Display X dropdown and right next to it a resolution dropdown.

Per default it is usually Free Aspect which means the camera resolution is whatever the resolution of the GameView window is.

enter image description here

Open the dropdown and click on + to create a new resolution option

enter image description here

Adjust it according to you needs e.g.

enter image description here

or using a dynamic resolution but fixed aspect ratio.

Now you can select it and no matter how the GameView window is scaled now it always keeps this fixed resolution (or aspect ratio) for the camera.

Upvotes: 2

Related Questions