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 Blue Solo · Nov 26, 2010 at 07:21 AM · buttoniphoneguitextfontguiskin

GUI Text as a Button?

I want to make a button that is just a custom font text, nothing around it. I tried creating a gui.Button and having no skin on it, adding my custom font and making it say "Play!". the problem is that in the GUISkin maker it asks for a text colour; this makes the text solid one colour, but it is a multicoloured texture font. So my question is: Is there a way to make GUI Text act as a button? Or: is there a way to make it skip the text color and leave my font the way it is?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by skovacs1 · Nov 26, 2010 at 09:05 PM

Yes. To make a GUIText GameObject act as a button, you merely need to add a script with the appropriate OnMouseDown and/or OnMouseUp and/or on MouseOver and/or OnMouseExit and/or OnMouseEnter function(s) implemented for the button functionality that you desire.

No. A font merely provides information about character shapes, not about their content, so there is no "skip the text color" as the font does not contain colour information. Unity provides only one color with which to color fonts. Applying specific colours or textures to fonts is a bit more complicated a feature than Unity's GUIStyle, etc. seems to provide. Pretty much the only way to custom colour font data would be to use a GUIText GameObject or texture of your font text or several separate objects with different settings which still won't apply anything but solid colors across each object.

Feel free to roll your own GUI implementation if you like and add this functionality. Even a script that takes the text from the font and some other information and generates the textures for you might be an approach to meet your needs.

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

Display two byte character by using GUIText.(Unity iPhone) 1 Answer

Changing the font size of GUIText (on Unity iPhone)? 1 Answer

Simple way to change GUIText font size 4 Answers

How To Add Button Images To GUIText? 1 Answer

iPhone Touch Screen? 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