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 Etarnalazure · Sep 15, 2012 at 11:18 PM · c#guitextureguitext

Replacing letters with images?

Hello everyone! I've been working on a Doom clone for a class project for the past few days, however it cant seem to get the text styling just right (Been looking around and it seems theres nothing to be done about that.

So i was wondering if its possible to replace a letter with a image?

The letters i want replaced is a GUIText object that displays the users health. However i cant seem to figure out how to 'add' in pictures. I'm guessing I'm going to have to use GUITexture instead, but a GUITexture can only hold one image at a time? (I think), so I'm stuck with not being able to display anything more then the first image (Like the image that displays a "1").

Of course i have not tried this yet, I'm going to try it out after this has been posted. But in case i cant get it working I've put this up.

Hopefully someone 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 Lockstep · Sep 15, 2012 at 11:58 PM 0
Share

I kinda don't get what you are trying to do. Are you trying to ad an icon for the health? In this case I would suggest to use a GUITexture for the icon and a GUIText next to it for the actuall number. If you want to change the appearance of your letters then you should use a different font. There is even a doom like font available http://www.dafont.com/amazdoom.font . The lisence is Creative Commons Attribution-Noncommercial this should fit for a class project.

avatar image Etarnalazure · Sep 16, 2012 at 12:12 AM 0
Share

The problem is that its not actually completely like the real Doom font, the % looks different, and other then that i need the style of the text. I'm trying to make it so that if the player has 100 health, the 2 images "1.png, 0.png" will replace them. So that the 1 will be replaced with "1.png" and the 0'es will be replaced by "0.png". I've found a way to do this though, by having 4 GUITextures and then making 100 If's i can get what i want.. However that is just stupid =/ Was hoping there was a way that woulden take up 300-400 lines of code.

1 Reply

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

Answer by Eric5h5 · Sep 16, 2012 at 12:18 AM

Use a bitmapped font with GUIText, then it can look like whatever you want. (It must be a GUIText object, since only TrueType fonts work with OnGUI code.) See SaveFontTexture if you want to modify an existing TTF.

Comment
Add comment · Show 5 · 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 Etarnalazure · Sep 16, 2012 at 12:41 AM 0
Share

Awesome! Will check it out! I just spent 30$$anonymous$$ progrma$$anonymous$$g 500 lines of "If this and that then do this" xD

avatar image Eric5h5 · Sep 16, 2012 at 01:21 AM 0
Share

You could probably reduce that to 5 lines of code by using arrays, but nevertheless, using GUIText is more convenient.

avatar image Etarnalazure · Sep 16, 2012 at 04:02 AM 0
Share

Unfortunantly i coulden seem to get that working =/

avatar image Eric5h5 · Sep 16, 2012 at 05:22 AM 0
Share

Why not?  

avatar image Etarnalazure · Sep 16, 2012 at 06:53 AM 0
Share

Just refused to work. Unfortunantly i dont have the time to mess about with it. I've made the 100 if sentences and I'll stick to that for now. Thank you for the help.

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

Multiple Cars not working 1 Answer

How to Show / Hide a GUI Texture 1 Answer

generate GUIText at runtime C# 3 Answers

Why is my OnCollisonEnter not working? 1 Answer

A node in a childnode? 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