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 ArkarKyaw · Oct 10, 2012 at 06:42 AM · guitextfont

How To change guiText's font dynamically in runtime(or) by script?

Hi, Everybody I m facing a problem in changing guitext font dynamically? I didnt found any solution yet on the net. Is there any solution? Please.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by JMAA · Oct 10, 2012 at 11:53 AM

Try to create first the font materials you need your guiText's set to, and then use this bit of script:

 //Make sure this array is set with the fonts you need in the inspector!!
 public var fontMat : Material[];
 
 //This is where you set the default font
 function Start () {
     renderer.material = fontMat[0];
 }
 
 //To set default again
 function FontDefault () {
     renderer.material = fontMat[0];
 }
 
 //Use I.E: ChangeFont(2) to change to the second set font
 function ChangeFont (id : int) {
     renderer.material = fontMat[id];
 }
 //This is where you set the default font
 function Start () {
 
 }
 
 function ChangeFont () {
 
 }

Someone hopefully will know a more straight way of changing the font here, but the fonts always depend on font materials AFAIK.

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 ArkarKyaw · Oct 11, 2012 at 03:25 AM 0
Share

Thank you so much.

avatar image
0

Answer by fafase · Oct 10, 2012 at 11:37 AM

It is in the docs actually:

Declare as many variables as you need, you might want to create an array. Then simply assign the appropriate one.

 var font1:Font;
 var font2:Font;
 
 guiText.font = font1;
 guiText.font = font2;
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 JMAA · Oct 10, 2012 at 12:45 PM 0
Share

Huh. Didn't remember that BTW.

avatar image ArkarKyaw · Oct 11, 2012 at 03:26 AM 0
Share

Thank you so much fasfase.Actually, I would like to know how to load (or) access installed font.

avatar image fafase · Oct 11, 2012 at 06:03 AM 0
Share

You might want to have a look at the Resources class. http://docs.unity3d.com/Documentation/ScriptReference/Resources.html

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

11 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

Related Questions

Canvas Text gets garbled 0 Answers

Need urgent help with dynamic font not working on Mac! 1 Answer

GUIText doesnt show after changing font 1 Answer

Changing GUIText.font on runtime 1 Answer

Using fonts in Unity - iOS devices 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