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 Blankdud · Jun 16, 2017 at 12:33 PM · 2duiguitext

Having a lot of trouble with GUI scaling

I'm working on an old-style RPG for practice with Unity2D. Right now I am trying to simulate a dialogue box like you would see in any RPG.

My issue is that it seems no matter what settings I use, I cannot get the size of dialogue boxes and text to be consistent. Ideally, regardless of resolution I want the boxes to always occupy the same amount of space, and the font to always be the same size and laid out the same way.

I've tried playing with the Canvas Scaler options, adding Horizontal Layout Groups, Content Size Fitters and my lack of experience is just stomping me.

As an example, if you look at the newer game Cosmic Star Heroine, it handles the dialogue boxes and texts the way pretty much how I would want to. Even scaling the resolution up quite high, I can still make out how many pixels are in the font.

I'd like to get this working in the GUI before I even look at scripts, so I have a good idea of what settings I am playing with. If anyone could point me in the right direction, that would be amazing.


EDIT - For clarification of what I'm trying to do.

I made a basic canvas with a panel and a text component:
Canvas - http://imgur.com/JSmg2d9
Panel - http://imgur.com/p0b1Ijq
Text - http://imgur.com/ldAR5Fa

If I keep the aspect ratio at resolutions of 16:9, it works great and always looks the same. (At least close enough). Howeverm if I switch to a different aspect ratio, the text will jump around and words with move to different lines, etc.

16:9 - http://imgur.com/maeHeb5
4:3 - http://imgur.com/NjdqXOx

The text clearly is shifting around on different aspect ratios.

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
0

Answer by Finijumper · Jun 16, 2017 at 12:44 PM

Comment
Add comment · Show 5 · 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 Blankdud · Jun 16, 2017 at 01:23 PM 0
Share

I tried this out, and it did work for the most part but not exactly what I was ai$$anonymous$$g for.

Ideally when I change the resolution, if I had a line of text filling the first line of the text box, I would expect that same text to still fill that same first line. This method seems to shuffle the text around.

avatar image harrismak4 · Jun 16, 2017 at 02:32 PM 0
Share

Set "$$anonymous$$atch" value to 0.5 so it will scale in both height and width, and Textbox property to Best fit. set $$anonymous$$ max font size.

avatar image Blankdud · Jun 16, 2017 at 04:45 PM 0
Share

@harrismak4 I see this does work really well as long as I keep the aspect ratio the same. What would I need to modify to make this work across different aspect ratios like 4:3?

avatar image harrismak4 · Jun 18, 2017 at 06:47 AM 0
Share

All you have to do is the pivot and anchor settings..

GUI system uses "anchors" to control how gui elements (like buttons) scale in relation to their parent container.

Unity has a tutorial video on how to use the new "Rect Transform" component (where the anchors are configured) here: http://unity3d.com/learn/tutorials/modules/beginner/ui/rect-transform.

avatar image Blankdud harrismak4 · Jun 18, 2017 at 08:24 PM 0
Share

@harrismak4 I updated my question with more information, as I still don't seem to be able to make any progress. I'm familiar with the anchors and how they work but the pivot seems like a non-issue in this case.

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

175 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 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

Multiple NPCs 1 Answer

Unity 5 GUI Buttons Won't Show When Built 0 Answers

Place UI element on pointer up position. 1 Answer

Find GUI Button and Assign Text 1 Answer

Why does my UI.text only update when I change weapons? 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