- Home /
BCE0044: expecting (, found 'OnTriggerEnter'.
Okay I'm working on a script that turns a light on if you are standing on a cube, if you step off the light turns off. If NOLon > NOL than the light should just turn on (please note NOL and NOLon are changed in other scripts). I am getting a strange error, help. This is the error: Assets/FinishLevel.js(10,18): BCE0044: expecting (, found 'OnTriggerEnter'.
var lightObject : Light;
static var NOL = 1;
static var NOLon = 0;
while(NOL > NOLon){
lightObject.enabled = false;
function OnTriggerEnter () {
lightObject.enabled = true;
};
};
I looked this up in answers and usually I found that the person was defining a function within a function. Am I doing that? Oh, and I am currently working on a tutorial, so don't tell me to go back to tutorials. I just want a quick answer to what this error means.
Answer by Lovrenc · Jan 20, 2013 at 02:51 AM
You cant just use while statements outside of a function.
Your function definition is inside of other statements.
Basically, except the variable definitions (which also contains dangerous static variables) there is nothing right about this code.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091230im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
False Errors? BCE0044 expecting :, found ";" 1 Answer
BCE0044 expected EOF and } found 'else' Help me Please!! 1 Answer
Why cant I connect to the server? 2 Answers