- Home /
OnMouseUp error
Ok so im getting an error with a script that i have used before and i cant figure out what too do to fix the issue. The script im using (ill post it below) highlights text options (3d text) when i scroll over them (which works). But The ability to click on the text and for it to do something wont work. I tried using Input.Getbutton, and OnMouseUp() but neither seemed to work.
I keep getting this error
NullReferenceException: Object reference not set to an instance of an object hover Script.OnMouseExit () (at Assets/Resources/NewScripts/hover Script.js:10) UnityEngine.SendMouseEvents:DoSendMouseEvents()
This is the script
[CODE]ar levelToLoad : String; var soundhover : AudioClip; var beep : AudioClip; var QuitButton : boolean = false;
function OnMouseEnter() { audio.PlayOneShot(soundhover); renderer.material.color = Color.green; }
function OnMouseExit() { renderer.material.color = Color.white; }
function OnMouseUp() { audio.PlayOneShot(beep); yield new WaitForSeconds(0.35); if(QuitButton) { Application.Quit(); } else { Application.LoadLevel(levelToLoad); } } @script RequireComponent(AudioSource)[/CODE]
Your answer
![](https://koobas.hobune.stream/wayback/20220613082720im_/https://answers.unity.com/themes/thub/images/avi.jpg)