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 theredace · May 19, 2014 at 06:05 PM · guiguitext

Using GUIStyles/GUISkins with GUIText objects?

I initially learned how to make GUI's using OnGUI, but since it's inefficient for mobile devices I'm switching over to using GUIText objects. The one thing that I can't figure out is how do I assign a GUIStyle or a GUISkin to my GUI.Text? It has no variable for this like a GUI.Label does, and a GUISkin has no setting for GUI.Texts... it just has text fields and text areas, neither of which apply to my GUITexts.

Are GUIStyles and GUISkins only used with OnGUI? If so, how do I create some template GUI settings to apply to multiple GUITexts so I don't have to manually set this stuff every time?

Comment
Add comment · Show 1
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 theredace · May 19, 2014 at 09:04 PM 0
Share

Anyone have an idea?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Eric5h5 · May 19, 2014 at 10:17 PM

GUIText objects are a separate system from OnGUI code and the two do not interact in any way. OnGUI isn't that inefficient, so I'd recommend not switching anything. You'll gain little or nothing by using GUIText objects.

Comment
Add comment · Show 4 · 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 theredace · May 19, 2014 at 10:46 PM 0
Share

Having looked around quite a bit on the topic, you seem to be in the $$anonymous$$ority with that opinion. Everything I've read has basically said that OnGUI is checking up to twice every frame plus once every event call, and most everybody (including Unity themselves) say DON'T use OnGUI for mobile games.

Also, this isn't an answer. Can you answer my actual question about how to create some template style (like a GUIStyle) but for a GUIText object?

avatar image Eric5h5 · May 20, 2014 at 12:42 AM 0
Share

That advice was from years ago when mobile devices were much slower and more limited. A modern mobile device won't have any issues with OnGUI unless you push it really hard. It's never a good idea to make changes unless you actually know for sure that what you're doing is a problem that needs to be solved. Don't make assumptions: profile first.

And yes, it's an answer. Your question was using GUIStyles with GUIText objects, and the answer is that it's not possible. I'm sorry if you don't want to hear that, but nevertheless it's true.

avatar image theredace · May 20, 2014 at 02:32 AM 0
Share

Dude, not everybody has a "modern" mobile device. I'm still trying to support older devices so this is a completely valid concern. I don't need to profile, because I don't even have the devices that I'm trying to code for.

And my question was specifically asking what you do to save settings across multiple GUITexts in the event that you can't use GUIStyles. You didn't answer that... just reiterated that I can't use GUIStyles. I get it. But is there an alternative for GUITexts?

avatar image Eric5h5 · May 20, 2014 at 04:39 PM 0
Share

Yes, basically everybody who runs Unity content has a modern mobile device. How big of a marketshare do you think the iPhone 1 has these days? Unity doesn't even have the option to do OpenGLES 1.0 or publish to anything less than iOS 4.0 anymore. $$anonymous$$obile hardware changes fast.

There are no GUIStyles or any way to do templates for GUIText objects, obviously aside from just duplicating an existing object and changing the text. They are very old and fairly primitive (from Unity 1 days). Again, sorry, but sometimes you just have to accept that the answer is "no".

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

GUI Text Component Rotate ? 1 Answer

How to change font size in ongui function 0 Answers

Relative GUI positioning and Pixel Inset/Offset conversion 2 Answers

Check if GUI is Pressed 1 Answer

How do i make a text box appear on screen after a chest has been opened? 3 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