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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by john 9 · May 14, 2011 at 07:14 PM · fontcustom

Update GUI on script

Hi again and thanks for looking again lol

The problem i have now is i don't understand how i can update my score script with with textures or custom fonts. What i want is something like angry birds how they have a custom font and it splashes on the screen for a short while but i don't understand the gui.Text or the texture2D. What i mean to say is i don't understand how to use them and how to call them.So that when i collect something that has point value it displays and updates the gui or texture. Could some kind soul give me an example?

var addpoints = 0000; var healthsound : AudioClip;

 function OnTriggerEnter (other : Collider) {
     if (other.gameObject.tag == "collect") {
         addpoints += 0005;
         Debug.Log ("Score = " + addpoints);
         Destroy(other.gameObject);
         AudioSource.PlayClipAtPoint(healthsound, transform.position);
     }
 }

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 Bampf · May 14, 2011 at 08:13 PM 0
Share

"Please look at this" isn't a question- please put the actual question at the top.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Hei · May 24, 2011 at 10:24 AM

How to make a GUI Skin and make your custom font?

Step 1

click Project/Create button and click GUI Skin , you will see the "New GUISkin" in the project.

Step 2

click the GUI Skin and see the Inspector , you will see the "Font" and you can change the font.

 var addpoints = 0000;
 var healthsound : AudioClip;
  //if you have a GUISkin , you can make your text beauitful!
 var yourGUISkin : GUISkin;

 function OnTriggerEnter (other : Collider)
 {
     if (other.gameObject.tag == "collect")
     {
         addpoints += 5;
         Debug.Log ("Score = " + addpoints.ToString("0000"));
         Destroy(other.gameObject);
         AudioSource.PlayClipAtPoint(healthsound, transform.position);
     }
 }

 function OnGUI ()
 {
     if (yourGUISkin)
         GUI.skin = yourGUISkin;
     GUI.Label(Rect(10,5,100,50),"Score = " + addpoints.ToString("0000"));
 }
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 HHameline · May 24, 2011 at 11:55 AM 0
Share

That's not going to achieve what he wants I think. He wants the score to pop up for a few moments and then to disappear adding it to the player's overall score what you have will just update the overall score not pop up text when the player receives points.

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

1 Person is following this question.

avatar image

Related Questions

Custom Font 1 Answer

Change the size of a custom font in a Canvas text 1 Answer

Custom Fonts... Missing on friend's computer 1 Answer

Clock, numbers past 2 digits???? 2 Answers

Is there a way to measure the pixel with/height of a string with a given font? 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