- Home /
why isn't my txt script working?
ok so my script should explain what I want it to do, but for some reason It does not work when I click it! neather does the mouse over work
function OnMouseEnter () { renderer.material.color = Color.green; }
function OnMouseExit () { renderer.material.color = Color.white; }
function OnMouseUp() { Application.LoadLevel(1); }
Answer by Minion54847 · Mar 24, 2011 at 12:09 PM
make sure that your text is outside of what you have it in front of, and if that don't work than try this instead.
var isQuitButton = false;
function OnMouseEnter() { //change the color of the text renderer.material.color = Color.green; }
function OnMouseExit() { //change the color of the text renderer.material.color = Color.white; }
function OnMouseUp() { //are we dealing with a Quit Button? if( isQuitButton ) { //quit the game Application.Quit(); } else { //load level Application.LoadLevel(1); } }
agian make sure that your text is in front of it not inside.
Answer by Alexandre Zakime · Mar 24, 2011 at 12:23 PM
If it's a GUIText try this:
guiText.material.color= Color.green;
Your answer
![](https://koobas.hobune.stream/wayback/20220613114608im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Object where the mouse is 4 Answers
GUI Remove focus from an editor text field when clicking elsewhere. 2 Answers
Intro GUI Text Script... 3 Answers
GUIText Help 1 Answer
3D Text Object does not change to the color specified on Mouse Over 0 Answers