Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 ThomasQ · Sep 08, 2011 at 12:26 AM · materialguitext

GUI Material Problem

Hi All!

I got a little problem when adding a material to a GuiText. The material has a standard GUI/Text Shader on it, and is set to red. Unfortunately, when added, it makes Blocks out of the font, wich is the standard one btw..

What am I doing wrong? Anybody any idea??

With Material:

Wrong one

Without Material

Good one

And this is the script used to generate the Timer

     private var startTime;
 var restSeconds : int;
 var roundedRestSeconds : int;
 private var displaySeconds : int;
 private var displayMinutes : int;
 var countDownSeconds : int;


 function Awake() {
     startTime = Time.time;
 }


 function OnGUI () {
     var guiTime = Time.time - startTime;
     restSeconds = countDownSeconds - (guiTime);

     if (restSeconds == 60) {
     print ("One Minute Left");
 }

     if (restSeconds == 0) {
     print ("Time is Over");
 }
 

             roundedRestSeconds = Mathf.CeilToInt(restSeconds);

          displaySeconds = roundedRestSeconds % 60;
          displayMinutes = roundedRestSeconds / 60; 

     text = String.Format ("{0:00}:{1:00}", displayMinutes, displaySeconds); 
     guiText.text = text;

 }
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 ThomasQ · Sep 09, 2011 at 12:14 AM 0
Share

I don´t know why, but the line with roundedRestSeconds = $$anonymous$$athf.CeilToInt(restSeconds); isn´t being displayed in Code format..

avatar image Waz · Sep 09, 2011 at 02:12 AM 0
Share

Because your indentation is all over the place. That line looks tabbed.

1 Reply

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

Answer by Waz · Sep 08, 2011 at 02:31 AM

You probably want this answer, although really it's simpler to just use OnGUI and set GUI.color.

Comment
Add comment · Show 3 · 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 ThomasQ · Sep 09, 2011 at 12:08 AM 0
Share

Thanks! But every solution is I found there is not really usefull to me. I am using a OnGUI function by the way, and GUI.color doesn't work though. I've posted the script I use above!

avatar image Waz · Sep 09, 2011 at 02:10 AM 0
Share

Strange, it has worked for many other people (see the up vote counts).

By "use OnGUI", I mean actually draw the text there, with GUI.Label().

avatar image ThomasQ · Sep 11, 2011 at 11:08 PM 0
Share

I shouldn't have doubted you ;) Thanks for the awnser!!

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

Animating GUIText material properties 0 Answers

Changing GUI Text colour when health is low 1 Answer

Need help with creating dynamic textures. 1 Answer

Editing the alpha of one GUItext edits the alpha of them all 1 Answer

How do I get the current alpha value of a material? 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