Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Leroterr · May 30, 2014 at 11:34 AM · guitexture3dtextscore

3D ^ Custom GUIText/Label or Making a Score System without using GUI?

I have a script that increases the int/float of the GUIText/Label when the player scores.

But GUITexts/Labels only supports Fonts, changing colors, and sizes.

Is there a way I can make a 3D or Custom GUIText/Label? What I mean by custom, is, for example, converting a PSD or PNG file to a single number, so for example, when the Player reaches the score "8", it will load up a PSD or 3D file that correlates with the number "8", instead of loading up the number "8" in the font file.

This way, I can have textures and stuff in my GUIText/Label, instead of just changing the colors, sizes, and font styles. Maybe a Sprite Renderer for each character/number?

If there's no way in doing this, then is there a better way of doing what I wanted to happen?

I saw Text Meshes as an answer when I was searching here on Unity Answers, but Text Meshes also just uses fonts.

Here's the script I'm using for the GUIText/Label:

 public class ScoreScript : MonoBehaviour {
 
 public static string text;
 
 public static float score;
 
 public Font font;
 
 GUIStyle style;
 
 void Start()
     {
         score = 0;
 
         //This just seems cheap. I need a sprite renderer for text instead of just using fonts.
         style = new GUIStyle();
         style.fontSize = 20;
         style.normal.textColor = Color.black;
         style.font = font;
     }
 
     void OnGUI ()
     {
         text = System.String.Format ("{0:0}", score);
         GUI.Label (new Rect (50, 50, 300, 300), text, style);
     }

And here's the script I use for the Score Increment System:

 public class Player : MonoBehaviour {
 
 //This turns true when a player scores.
 private bool playerScores;
 
 void Update () {
 
     if(playerScores)
         {
             //Increase the score
             ScoreScript.score += 1.5f;
             playerScores = false;
         }
 
 }

Thanks to anyone who can help :)

Comment
Add comment · Show 2
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 smoggach · May 30, 2014 at 02:57 PM 1
Share

I see no reason why this can't be accomplished with a sprite sheet.

avatar image Leroterr · May 30, 2014 at 05:04 PM 0
Share

Oh, thanks, I never knew a Sprite Sheet existed in Unity. I'll try it out later when I get home.

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

Why this Error when trying to add a score using the new GUI ? 0 Answers

3D GUI textures. 1 Answer

GUI text appears behind drawn texture. 0 Answers

Score and gui help 1 Answer

C#: Q about creating Score system using GUItext 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