- Home /
This question was
closed Nov 30, 2014 at 09:23 AM by
Graham-Dunnett for the following reason:
Duplicate Question
Question by
Harryliu · Nov 30, 2014 at 09:23 AM ·
javascriptnullreferenceexception
NullReferenceException: Object reference not set to an instance of an object
is there anything wrong with line 11, and 18? NullReferenceException: Object reference not set to an instance of an object
#pragma strict
private var mBlur : MotionBlur;
private var sanityScript : SanityManager;
function Start()
{
mBlur = GameObject.Find("Main Camera").GetComponent(MotionBlur);
sanityScript = GameObject.Find("First Person Controller").GetComponent(SanityManager);
mBlur.enabled = false;
}
function Update()
{
if(sanityScript.currentSanity >= 20)
{
mBlur.enabled = true;
mBlur.blurAmount = 0.6f;
}
if(sanityScript.currentSanity >= 40)
{
mBlur.enabled = true;
mBlur.blurAmount = 0.8f;
}
if(sanityScript.currentSanity >= 60)
{
mBlur.enabled = true;
mBlur.blurAmount = 1.0f;
}
if(sanityScript.currentSanity >= 80)
{
mBlur.enabled = true;
mBlur.blurAmount = 1.3f;
}
if(sanityScript.currentSanity >= 90)
{
mBlur.enabled = true;
mBlur.blurAmount = 1.6f;
}
}
Comment
Follow this Question
Related Questions
NullReferenceException help 1 Answer
A node in a childnode? 1 Answer
The infamous NullReferenceException again 1 Answer
null reference exception ... help! 2 Answers
Sync Text with audio 1 Answer