Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Eoghan · Dec 23, 2014 at 11:39 PM · 2duiunity 4.6

Unity4.6 : No scaling UI, Content vanishes in a smaller viewport

I've been building a game over the past few days, purely using the new UI tools - Canvas, nested images/sprites etc.

With my game viewport set to 1280x720, everything went great - until I exported at 1080p to see how it looked.

Unfortunately, it seems as though Unity does not scale the UI; at 1080p, it simply scales down the 1280x720 content.. and expands the viewport to fill the rest of the area. Which basically leaves around 1/3 of the screen completely blank.

Worse still, if I lower the resolution, it just cuts off everything that doesn't fit; so for exporting at 800x450 (standard 16:9 res for portals like Kongregate), around 1/3 of the game window vanishes completely. Further to this, if you edit the html, you can manually scale how large of a viewport you want.

I'm guessing this is something really mundane, as I'd be fairly surprised if Unity lost the ability to scale content :) unfortunately, I can't see anything glaringly obvious - but I've noticed that the root Canvas' width/height is matching whatever camera settings I input. Would someone be able to point me in the right direction of getting the canvas to scale appropriately?

edit: Seems I've gotton it fixed up for 16:9 resolutions by setting the canvas scaler to "expand" - however, if I leave the 16:9 resolution set, the viewport again expands/contracts and either reveals blank content, or cuts off content.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Srki94 · Dec 24, 2014 at 01:53 AM

In your Canvas gameObject, there is an component named "Canvas Scaler". Set "Ui Scale Mode" field to "Scale With ScreenSize".

Then go back to Scene and set up anchors for each UI element that you have. You will see that it will scale itself and respect that anchor no matter what resolution or ratio!

Use that canvas rect from Scene view as your representation of screen of device.

alt text

Edit : I just realized that this happens for you only at 1080p? If so I'm sorry - I didn't understand you when I first posted, however I'd keep this one to help everyone else with scaling :) (p.s. I don't know what you test your builds at but IIRC web player is limited to 720p)


example.jpg (273.2 kB)
Comment
Add comment · 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

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

27 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

Related Questions

Scoring System Unity 6.4 C# 2D Game 1 Answer

Unity 4.6 2D,UI apears under game Sprite 1 Answer

[4.6 2D] Making UI image stick to the side 1 Answer

My text is invisible if I put it under the Content object under a Scroll View 1 Answer

Best 2d User Interface for Mobile and Other platforms 1 Answer


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