Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by pigaroos · Oct 16, 2019 at 01:22 PM · canvasscalingthing

How to use canvas scaler?

Hello everyone, I am having trouble understanding how the Canvas Scaler component works. It seems to me that it takes a reference resolution and compares that to the device's resolution. So by what I understand, if the device resolution is divisible by the reference resolution, it scales correctly. So I assume that if the X field is set to 1 and the Match completely on Width (which I assume is X) then, because whatever X resolution is divisible by 1 (our reference X), it would, well, scale correctly.

But instead, everything gets huge, so would anyone mind explaining what is happening? Thanks.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hexagonius · Oct 17, 2019 at 08:29 AM 0
Share

There's an explanation for every single mode you can choose, did you read it?
https://docs.unity3d.com/$$anonymous$$anual/script-CanvasScaler.html

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cdr9042 · Oct 17, 2019 at 10:32 AM

Are you using "Scale With Screen Size" mode? In that case, you fill in the resolution of the screen you designed your UI for. For example, if your UI button's size was designed for a canvas size of 1920x1080, then you fill in X: 1920, Y: 1080 (16:9).

On the match slider, if you match width (0), and your game is played on a screen with resolution of 1280x1024 (4:3, or 12:9), since this screen size has lower width:height ratio than your reference resolution, the canvas's height will expand, its width will stay the same.

EDIT: @pigaroos Here's an example:


My background sprite has the resolution of 1424x640 (designed to fit 20:9 ratio screen)

alt text


My Canvas Scaler's setting: alt text


image-086.jpg (45.2 kB)
image-082.jpg (343.2 kB)
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image pigaroos · Oct 17, 2019 at 02:35 PM 0
Share

Thank you for answering! So I will have to detect what device is being used and adjust the scaler accordingly for every device on my target platform?

avatar image cdr9042 pigaroos · Oct 18, 2019 at 01:56 AM 0
Share

no, you don't have to detect device's resolution, you just choose one resolution and set the value, the Canvas Scaler will automatically adjust it on every device.

If you don't know which resolution to choose, just use the resolution of your current device

avatar image pigaroos cdr9042 · Oct 19, 2019 at 01:58 AM 0
Share

Thank you for going deeper into detail here. I'll test things tomorrow and see what happens.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

122 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Wrpping my head around canvas,Wraping my head around Canvas placement 2 Answers

DOTween Animations scaling with canvas? 0 Answers

Canvas, instantiate and adjust size of image to fit parent 0 Answers

Two panels to fit the size of the parent panel in Portret mode. 0 Answers

2d image does not scale/stretch correctly 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges