- Home /
Question by
Wedgebox · Jul 08, 2014 at 03:29 AM ·
javascriptbuildgame
Already has a definiton for
Here's my Script:
function Update () {
MyFunction;
}
var flashlightOn : boolean = false;
function Update () {
//Checks if the boolean is true or false.
if(flashlightOn == true){
light.intensity = 1;//If the boolean is true, then it sets the intensity to what ever you want.
} else {
if(flashlightOn == false){
light.intensity = 0;//If the boolean is false, then it sets the intensity to zero.
}
}
//Checks if the F key is down and whether the boolean is on or off.
if(Input.GetKeyDown(KeyCode.F) && flashlightOn == false){
flashlightOn = true; //If the f key is down and the boolean is false, it sets the boolean to true.
} else {
if(Input.GetKeyDown(KeyCode.F) && flashlightOn == true) {
flashlightOn = false;//If the f key is down and the boolean is true, it sets the boolean to false.
}
}
}
but now it says Type 'Flash Light' already has a definiton for 'Update().'
What does it mean? And what should I do to fix it?
Comment
Best Answer
Answer by Kiwasi · Jul 08, 2014 at 03:31 AM
You have a function on line 1 called Update ()
You have a function on line 8 called Update ()
Unity is confused. So am I.
The Update function on line one doesn't appear to do anything useful, delete from line 1 to line 3.
Your answer
Follow this Question
Related Questions
Error BCE0044 0 Answers
Distribute terrain in zones 3 Answers
i need help trying to build game 0 Answers
Instantiate problem in a RTS game 0 Answers
OnTriggerEnter not firing in game view 0 Answers