- Home /
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 :)
I see no reason why this can't be accomplished with a sprite sheet.
Oh, thanks, I never knew a Sprite Sheet existed in Unity. I'll try it out later when I get home.
Your answer
 
 
             Follow this Question
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
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                