• 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
Question by whiteant54 · Mar 17, 2015 at 09:21 PM · uitextcanvasscreen resolutionmainmenu

Unity 5 UI GUI Text Canvas Screen Resolution Adaption Problem

Hi, I want to have a UI Text with Canvas child (which is default). I would like it to be that when the screen resolution changes, it also fixes the text to fit. So, for short, for the text to fit any sized computer screen. I am making a main menu. Here are some pictures:

file:///C:/Users/anthony/Pictures/Screenshots/Screenshot%20(4).png file:///C:/Users/anthony/Pictures/Screenshots/Screenshot%20(5).png

The first one is full screen. The second one is a smaller screen. (Note how you can't see the text. The text is still there.) My goal is to be able to see the text even in the small screen. I am open to script(C# if possible) and also configurations (ex: Components) Whatever works. If you do provide script, please explain what object to attach it too as well as description. Thank you.

Comment

People who like this

0 Show 0
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

2 Replies

  • Sort: 
avatar image

Answer by DiegoSLTS · Mar 19, 2015 at 12:08 AM

Don't do what you suggested, is a really unflexible way of doing what you want.

Checkout the "UI scale mode" property of the Canvas Scaler component in your Canvas game object. It defaults to "Constant pixel size", a really bad option if you aim to more than one resolution, a window of 640x480 will only show a 640x480 rectangle from the top left corner of your canvas.

Change the UI scale mode to "Scale with screen size" and unity will shrink or expand your Canvas to best fit in your screen.

Comment
kaybee99
PricklyApps
daviddickball
Dahakra
seansulli
stas0
Owlbear_Headspin
muclem

People who like this

8 Show 1 · 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 Owlbear_Headspin · Mar 15, 2018 at 01:45 AM 0
Share

This totally worked for me. Thanks for the tip!

avatar image

Answer by whiteant54 · Mar 18, 2015 at 11:55 PM

FOR ANYONE WHO HAS THE SAME PROBLEM, LISTEN CLOSELY. ALL YOU NEED TO DO IS: Canvas -> "Your Text" -> Settings sign on the top right -> Reset

Then Under Rect Transform You: Anchors -> Min X: 0, Min Y: 0.5, Max X: 0, Max Y: 0.5

Then You: Pivot X: 0, Pivot Y: 0.5

When you do so, the top left square in rect transform should say on top: Left, and on the side: Middle. Then you may move your text/buttons anywhere you like. (Note: Anywhere in the canvas.) Make sure your Scale is X: 1, Y: 1, Z: 1. To resize your text, use the font controller. If you follow my instructions, when you play your game, (in the editor to test) you should be able to change the ratio from your game view to Free aspect, 5:4, 4:3, etc without losing view of your GUI text/buttons/image/etc. (PLEASE NOTE: Maximize on play MUST be selected.

Hope this helped since I know this is a big problem and I even had this problem myself.

Happy developing :)

Comment
Dimling
mitjag
tperezstolfa
coursebook07

People who like this

4 Show 1 · 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 tperezstolfa · Jun 08, 2017 at 10:24 PM 0
Share

Thanks man, I was going crazy heh

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

UI Relative to screen size 1 Answer

Shrink UI text background image to fit text 1 Answer

Canvas is flipping, 2D game 0 Answers

How do I carry over ui text to the next by obtaining the gameobject children 0 Answers

Text UI only shows up in game window but not in the build window 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