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
1
Question by .hooligan · Dec 08, 2010 at 01:10 PM · texturefontcustom

Custom score texture

I was just wondering if anyone has used a texture to display the score. What I want is to design my own numbers 0 - 9 and use this texture as the font display instead of a GUI font. Has anyone used this technique before. It's just a rough idea I was just wondering if there were any examples out there?

Thanks

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 Proclyon · Dec 08, 2010 at 01:24 PM 0
Share

I am a programmer and I am pretty much clueless about this kind of stuff, but can you not just use another font ins$$anonymous$$d of the existing one? I do know ttf and higher using B_curves makes them just as pretty when zoomed in or out and a.f.a.i.k. that does not work for textures

avatar image Justin Warner · Dec 08, 2010 at 01:25 PM 0
Share

Just do it with a ttf, doing it your way is more complicated than it should/has to be, and it would look uneven and sloppy... Why try to do something pretty much pointless when you can do something that people have documented, and the results would look better... Just my opinion though...

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by denewbie · Dec 08, 2010 at 01:25 PM

To design textures fonts:

  • Design 0 - 9 like you mentioned

  • An array of Texture2D and them in, index 0 for 0 and so on till 9

  • For the score you're setting, store it as a numeral as per normal

  • When you want to display the score, convert it to string and parse each character as an integer and use the parsed integers as indexes for your textures.

    public Texture2D[] myArray; // slot in your textures on the editor.

    int myScore = 10000; // Put any number int textureDimension = 50;

    void OnGUI(){

    string myStringScore = myScore.ToString();

    for (int i =0 ; i < myStringScore.Length ; i++) GUI.drawTexture(new Rect(i * textureDimension , 0, textureDimension ,textureDimension ) , myArray[int.Parse(myStringScore[i] ) ] );

    }

    Comment
    Add comment · Show 6 · 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 denewbie · Dec 08, 2010 at 01:29 PM 0
    Share

    Something went wrong with the html formatting. I set the code properly but it just didnt turn out right...

    avatar image denewbie · Dec 08, 2010 at 01:30 PM 0
    Share

    I havent tested the code out cause I dont have unity with me but I hope you can get the idea.

    avatar image .hooligan · Dec 09, 2010 at 01:10 AM 0
    Share

    Hey denewbie, thanks heaps for this. $$anonymous$$akes perfect sense! I haven't tested it yet but it looks like it will work. I'll let you know how it goes. Thanks again

    avatar image denewbie · Dec 09, 2010 at 05:36 PM 0
    Share

    No prob. This is definately a workable solution. If there's any trouble its probably just a few $$anonymous$$or bugs. If there's any trouble just come back to me.

    avatar image POLYGAMe · Jan 06, 2012 at 09:25 AM 0
    Share

    Can't seem to get this to work. Anyone had any luck?

    Show more comments
    avatar image
    0

    Answer by jeriitan · Jan 26, 2012 at 04:39 AM

    Can you convert that to JS?

    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 syclamoth · Jan 26, 2012 at 04:40 AM 0
    Share

    If you want a conversion done for you, post a different question ins$$anonymous$$d of cluttering this one.

    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

    4 People are following this question.

    avatar image avatar image avatar image avatar image

    Related Questions

    How do I put an image inside text? 2 Answers

    how to set a texture and another font in a GUI Text 2 Answers

    How to access a Text Mesh Pro Font Asset's glyp info from c#? 1 Answer

    Can I get color(or grey scale value) array for a font given a font size without using render texture? 0 Answers

    How to make custom terrain textures 0 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