- Home /
Error BCE0077
So I am doing a flashlight for my game, and I want the feature to toggle the light on and off. But I get Error BCE0077 : It is not possible to invoke a expression of type 'boolean'. My question is: what is wrong with my script? Have I done something wrong here?
Here's my script :
var LightObj : GameObject;
var Status = true;
function Update () {
if(Input.GetKeyDown("f")){
if(Status == true){
Status == false();
}
else
if(Status == false){
Status == true();
}
}
}
function CheckStatus () {
if(Status == true){
LightObj.Light.enabled = true;
}
else
if(Status == false){
LightObj.Light.enabled = false;
}
}
Did my answers help at all? Note, it's considered common courtesy to vote up a helpful answer, and/or mark an answer as the answer if you asked the question.
Answer by Keith1024 · Apr 28, 2013 at 12:06 PM
You are attempting to call false as if it were a function.
Just remove the parenthesis on line 9 and 15. You are also performing a conditional check in those lines rather than assignment. So you may want to fix that too. ;)
Keith
Well, a conditional check is performed by ==, in this case the check is for equality. An assignment is performed by =, which assigns the operand to the right of the =, to the operand on the left. So just change the == to = in lines 9 and 15.
false
is a value, like 4
is a value. So just as you can write X = 4
you can write Status = false;
Your answer
Follow this Question
Related Questions
Error... that I don't understand. 3 Answers
How to link this 2 variables from 2 different scripts / gameobjects? 1 Answer
How to change public variable by another script 0 Answers
lighting click help 3 Answers
error with footsteps script 1 Answer