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 pete43 · Jan 08, 2015 at 02:32 PM · gui.label

Gui label score larger with cs

Hello, Can someone please show me how to make this gui label score larger with cs code? score display img

here is the code I'm using:

 void OnGUI(){
         GUI.color = Color.red;
         GUILayout.Label(" Hit: " + score + "/" + spawnedObjects);
     }

Thank you

Pete S.

screen shot 2015-01-07 at 6.10.34 pm.png (7.4 kB)
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 pete43 · Jan 08, 2015 at 02:57 PM 0
Share

Thanks Landerm,Could you provide me an example how i Would do that with what I have now? I didn't create it myself and not sure what to do.

3 Replies

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

Answer by Qasem2014 · Jan 09, 2015 at 06:01 PM

right click on "project" panel and from "create" menu choose "GUI Skin" . then create a new script and write :

 var GUISKIN : GUISkin;
 
 function OnGUI()
 {
     var SW = Screen.width; var SH = Screen.height;
     GUI.skin = GUISKIN; GUI.skin.label.fontSize = SW/35;
     GUI.Label(Rect(SW/2,SH/2,200,200),"AAAA");
 }

assign your created GUI Skin to GUISKIN variable then test it

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
avatar image
0

Answer by Landern · Jan 08, 2015 at 02:34 PM

Legacy GUI objects can take a GUIStyle object which can be assigned to a GUI Label. You can define the font size that will increase the displayable size of the text.

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
avatar image
0

Answer by Qasem2014 · Jan 08, 2015 at 06:15 PM

you can change the font size with code :

 GUI.skin.textField.fontSize = SW/35;

;)

textField can be a box or ...

Comment
Add comment · Show 6 · 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 pete43 · Jan 08, 2015 at 08:37 PM 0
Share

This is what I have tried but I keep getting a compiler error:

 void OnGUI(){
 
         GUI.skin.textField.fontSize = SW/35;
         GUI.color = Color.red;
         GUILayout.Label(" Hit: " + score + "/" + spawnedObjects);
     }
     
 Thanks anyways any other ideas?

Pete

avatar image Qasem2014 · Jan 09, 2015 at 06:08 PM 0
Share

see this link . i don't use GUILayout.Label before . i don't know how can you change the font size for GUILayout.Label . so i write a GUI.Label ins$$anonymous$$d of that :)

avatar image pete43 · Jan 09, 2015 at 09:00 PM 0
Share

Thanks man, this is way more involved than I ever anticipated

avatar image pete43 · Jan 09, 2015 at 09:40 PM 0
Share

I just watched a video on gui skins, it all make more sense too me now. I'll give i a try and report back on how it went.

avatar image Qasem2014 · Jan 10, 2015 at 10:10 AM 0
Share

your welcome

if your problem solved , you can close the question with tick this answer =D

  • convert my comment to answer*

Show more comments

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

GUI.Button("german umlauts like ") missing 2 Answers

GUI objects (Label and box) change their opacity for unknown reason. 1 Answer

Gui now showing up! Nothing to do D': 0 Answers

Proportional text screen 0 Answers

New line \n character is not working in GUILayout.label 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