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 renaldogoosen · Jun 28, 2011 at 02:47 PM · guitextfont

GUI text font change

I have this script running on my character (In JavaScript)for when i collect coins it'll add 5 points to my score. I have no idea how to change the Font of my GUI label?! Any Ideas??

var score = 0;

function OnTriggerEnter( hit : Collider){ if(hit.gameObject.tag == "Coin"){score += 5;Destroy(hit.gameObject);} }

function OnGUI () { GUI.Label (Rect (300, 25, 1000, 20), score.ToString()); }

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by GuyTidhar · Jun 28, 2011 at 02:55 PM

Create a GUISkin asset.

(right click menu in the project window -> GUISkin)

Within the create GUISkin look for "Label". Open "Label" and look for "Font" under it. Drag the font you wish to use into this field.

Now add the following line to the above script:

 public var guiSkin : GUISkin;

Change your OnGUI function to this:

 function OnGUI () 
 { 
   GUI.skin = guiSkin;
   GUI.Label (Rect (300, 25, 1000, 20), score.ToString()); 
 }

Drag the GUISkin asset you have created onto the guiSkin field of the above script.

Now you should have the new font!

Comment
Add comment · Show 3 · 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 renaldogoosen · Jun 29, 2011 at 12:31 PM 0
Share

Thank you very much.. It doesn't seem to be working at the moment but I'll search for the problem (Possibly a font issue, made sure it was TTF). A GUISkin should come in handy..

avatar image Salman9000 · Jan 06, 2014 at 07:41 PM 1
Share

Thanks! Just what i wanted! :D

avatar image GuyTidhar · Jan 07, 2014 at 09:16 AM 0
Share

cheers :) Glad to had helped!

avatar image
0

Answer by Tim.Holman · Jun 28, 2011 at 02:56 PM

If you create a GUI skin, you can modify anything you'd like very easily. You'll just have to put a font style in your project folder first, then drag and drop it into the font variable in the GUI skin.

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 MasterBLB · Jun 28, 2011 at 03:09 PM

Well,to have own font you'll need such steps:

1.Put yourDesiredFont.tff into yourProjectFolder/Assets.More details there http://unity3d.com/support/documentation/Components/class-Font.html

2.As guyt says,create a GUISkin asset.

3.Click the GUISkin,and you see components like button,label,box etc that may be expanded.Expand component label and then you will see font options like Font(family),FontSize and FontStyle(bold etc)

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Odd question... can a GUIText object be displayed upside-down? 2 Answers

Changing a GUILabel text SIZE 3 Answers

Why aren't asian fonts rendering dynamically? 0 Answers

Problem with GuiFont - Not appearing 0 Answers

Color.white not so much white... 3 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