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
1
Question by drhmiri · Apr 26, 2015 at 06:53 PM · guilayoutguilayoutlabel

Additional parameters for GUILayout.Label

I use the following syntax to enlarge the text font of a Label in Unity:

 GUILayout.BeginHorizontal( displayStyle1 );
 displayStyle1.fontSize = 20;
 GUILayout.Label( questiongrid.Title, displayStyle1 );
 GUILayout.EndHorizontal();

But in the following code, it seems that all the possible options have been exhausted, at least to my understanding of the manual pages:

 GUILayout.BeginHorizontal( GUILayout.Height( maxHeights[currentIndex] ) );
 GUILayout.Label( questionScreens[currentIndex][i], rightStyle, GUILayout.Width( Screen.width/3 - 3 ) );
 GUILayout.EndHorizontal();

Could I still manipulate this code and enlarge the text font (of course without having to lose or replace rightStyle)?

Please see attached... I need to increase the font size for the scale boxes that say 1, 2, 3, 4, 5

Thanks

alt text

scalefont.png (114.3 kB)
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
2
Best Answer

Answer by DoTA_KAMIKADzE · Apr 26, 2015 at 06:56 PM

Seems like I'm missing some part of your point but anyway, why not just increase the font if you need to?:

     rightStyle.fontSize = 50;
     GUILayout.Label(questionScreens[currentIndex][i], rightStyle, GUILayout.Width(Screen.width / 3 - 3));
     //or if you want to keep rightStyle with its original values but change font size only for this lable then:
     GUIStyle newStyle = new GUIStyle(rightStyle);
     newStyle.fontSize = 50;
     GUILayout.Label(questionScreens[currentIndex][i], newStyle, GUILayout.Width(Screen.width / 3 - 3));
Comment
Add comment · 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 drhmiri · Apr 27, 2015 at 12:53 PM 0
Share

Thank you.. It was spot on. I was under the impression that a new variable must be introduced as an additional parameter! Your suggestion works perfectly. Cheers

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

know GUILayout current screen position 2 Answers

GUILayout Sort Problem 1 Answer

Make children of a Layout Group fit their respective sizes (confusing docs) 1 Answer

Why does old text in GUILayout not disappear? 1 Answer

Fade out GUILayout Area? 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