- Home /
Bug with my menu script
Hello, i have a problem with my menu script. When i put my mouse on the guitexture, it changes on a other texture but it doesn't work
there is my script:
var levelToLoad : String;
var normalTexture : Texture2D;
var rollOverTexture: Texture2D;
var beep : AudioClip;
var QuitButton : boolean = false;
function OnMouseEnter(){
GUITexture.Texture = rollOverTexture;
}
function OnMouseExit(){
GUITexture.Texture = rollOverTexture;
}
function OnMouseUp(){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
if(QuitButton){
Application.Quit();
Debug.Log("this part works!");
}
else{
Application.LoadLevel(levelToLoad);
}
}
@script RequireComponent(AudioSource)
But unity say: MissingFieldException: Field "unityEngine.GUITexture.Texture" not found
I don't understand the problem =s Can you help me? Thanks in advance and sorry for my english ^^Bug with
Answer by whydoidoit · May 26, 2012 at 03:48 PM
You need to use "texture" not "Texture". Note that the variable name has a lowercase "t"
Answer by saudius · May 26, 2012 at 08:01 PM
Tank you, now it's working But i have a new problem... When i put my mouse on the texture, now, it change but when i go out of the texture, it not refresh and it keep the new texture :s
I don't know if you understand me =s
Did this work now? If so can you mark the question answered?
Answer by whydoidoit · May 26, 2012 at 08:08 PM
That's because you are setting the same texture in both of the routines. Figure you meant to use normalTexture in the OnMouseExit
Your answer
Follow this Question
Related Questions
Character spawn menu bug 0 Answers
How do you make a collapsible menu in the UI? 1 Answer
How do I create a in-game music library that my character can use? 0 Answers
Pause Game does not lauch new menu 1 Answer
New dropdown menu sample 3 Answers