- Home /
Question by
WBrouwer · Mar 09, 2014 at 10:41 PM ·
parsing error
Unity stealth tutorial script problem
I'm currently following the unity 3d stealth tutorial and I keep on getting parsing errors. And I have the script copied exactly down to the final semi-colon
using UnityEngine;
using System.Collections;
public class AlarmLight : MonoBehaviour
{
public float fadeSpeed = 2f;
public float highIntensity = 2f;
public float lowIntenstiy = 0.5f;
public float changeMargin = 0.2f;
public bool alarmOn;
private float targetIntensity;
void Awake()
{
light.intensity = 0f;
targetIntensity = highIntensity;
}
void Update()
{
if (alarmOn)
{
light.intensity = Mathf.Lerp (light.intensity, targetIntensity, fadeSpeed * Time.deltaTime);
CheckTargetIntensity();
}
else
{
light.intensity = Mathf .Lerp (light.intensity, 0f, fadeSpeed * Time.deltaTime);
}
}
void CheckTargetIntensity()
{
if (Mathf .Abs (targetIntensity - Light.intensity) < changeMargin)
{
if(targetIntensity == highIntensity)
{
targetIntensity = lowIntenstiy;
}
else
{
targetIntensity = highIntensity;
}
}
}
}
Please tell what I did wrong.
screen shot.gif
(45.5 kB)
Comment
Best Answer
Answer by robertbu · Mar 09, 2014 at 10:43 PM
On line 35, change 'Light' to 'light'. 'Light' is the class. 'light' is a short cut in the GameObject to the specific light script attached to this game object.
Your answer
Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
Unity Block 0 Answers
Imported character showing transparent in unity 1 Answer
Temperature Script? 3 Answers
How to get rid of lines on terrain? 2 Answers