Trying to get a simple bit of GUIText to fade in and out using transparency. Wrote a script that should only affect one GUIText but all of them are fading in and out. What am I doing wrong?
[Fade in/out script][1] [1]: http://pastebin.com/print/Aq63gQVu
I'm not sure if I put that link in correctly. Apologies if not.
Basically, gameovertext is a GUIText in my implementation of the Space Shooter tutorial, but the script is making all other GUIText fade in and out with it, even though I've implemented the reference to the GUIText in like the most specific way I can imagine.
What am I doing wrong here?
Answer by Ygedey · Feb 13, 2016 at 08:02 AM
I think this is because you are changing the color of the material of the font. Since all your text probably uses the same font, this will change the material of all those text objects.
I copied your code and removed ".font.material" from all the places you changed the color at, and it works fine for me now.
I also switched from GUIText to UI/Text which has replaced GUIText in newer versions of unity, but this should work the same with GUIText.
Thanks so much for the quick, helpful answer!
I thought the color was a property of the font.material. I didn't realize GUIText objects had a .color field of their own.
God bless you!
No problem! Please mark my comment as answer if it answered the question completely! :)
Your answer
Follow this Question
Related Questions
how do I rezolve "look rotation viewing vector is zero"? 1 Answer
How to change drawing order in Unity? 0 Answers
Refer to GUIText from C# Script 0 Answers
Respawn point 1 Answer
Rigidbody.position: How can i make my player to not leave the field 0 Answers