- Home /
Question by
Kaosaurus · Jul 18, 2013 at 03:35 AM ·
javascripterrorbuild
NullReferenceException: Object reference not set to an instance of an object at QuitGameScript.OnMouseEnter () [0x00000
var levelToLoad : String;
var beep : AudioClip;
var QuitButton : boolean = true;
function OnMouseEnter()
{
audio.PlayOneShot(beep);
renderer.material.color = Color.green;
}
function OnMouseExit()
{
renderer.material.color = Color.white;
}
function OnMouseUp()
{
if (QuitButton){ Application.Quit(); }
else{ Application.LoadLevel("levelToLoad"); }
}
Comment
Answer by Adamcbrz · Jul 18, 2013 at 04:15 AM
Based on your code I would assume that audio is returning null or renderer is returning null. audio assumes you have an audiosource attached to this gameObject. renderer assume either a mesh renderer or skinned mesh renderer. Are you sure these components are attached?
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Script not working (Java script) 2 Answers
I can do this in JS or not ??? 2 Answers
Android Build problem? 2 Answers