denisrk
denisrk

Reputation: 31

Unity3D: Aspect ratio issue

In Unity3D I can't scale the game properly to remove the black bar.

I've added pictures for reference:

image

EDIT: I need to make the canvas scale to the whole screen instead of only a part of the screen.

Upvotes: 3

Views: 1026

Answers (5)

hamza mustafa
hamza mustafa

Reputation: 61

Set the screen resolution manually in the Start() of your code:

Screen.SetResolution(x, y, true)

Upvotes: 0

Jagger R. House
Jagger R. House

Reputation: 72

Try to dynamically spawn the background or image by using Scale To Fit lots of Unity Documentation to help with that so when compiled you can tend to get a stronger and fuller picture this may help with a general sizing issue

Upvotes: 0

Faisal Khalid
Faisal Khalid

Reputation: 650

You have to set anchors of Image to each corner of your canvas display so It can scale accordingly.

Upvotes: 3

Antz
Antz

Reputation: 31

Just change the aspect ratio from 'free aspect' to '16:9' or manually enter an aspect ratio that suits your needs.

Cheers.

Upvotes: 0

Andy
Andy

Reputation: 2414

You should first set your game viewport to simulate the resolution and screen size of whatever you're building for. Change Free Aspect to the appropriate aspect ratio or manually add a new resolution.

Also, I believe the match mode you want for your Canvas Scaler is Match Width or Height.

Upvotes: 4

Related Questions