Error: The best overload for the method 'function(Object): boolean' is not compatible with the argument list '()'.

I nee some help with my code I have a light that I want to be able to turn on and off by pressing a button, Until two other variables, Nol and NOLon, (they are increased in other scripts) have reached a certain number. I continue to get a message that to me doesn’t even make any sense

Assets/FinishLevel.js(14,9): BCE0017: The best overload for the method ‘function(Object): boolean’ is not compatible with the argument list ‘()’.

The code looks like this:

var SecondLight : Light;
static var NOL = 0;
static var NOLon = 0;
var GO = function (OnTriggerEnter){
   	SecondLight.enabled = true;

};
var SO = function (OnTriggerExit){
    SecondLight.enabled = false;

};

while(NOL > NOLon){
	GO();
	SO();
	
};
SecondLight.enabled = false;

It looks like you have no idea what you’re doing (syntax-wise), and you should go back to Unity’s official tutorials to get a grasp of Unity’s syntax. I highly recommend against using non-official tutorials until you have a good grasp of what’s what, as they frequently omit necessary information.

Functions are usually used like this:

private var arg : ArgumentType;

function AFunction(argument : ArgumentType) : ReturnType {
  var out : ReturnType = ...;
  ...
  return out;
}

function Update() {
  var result : ReturnType = AFunction( arg );
}

I think you’re getting the error because you’re calling GO and SO without passing in the parameters you set for them.

It looks like you intended to have the actual OnTriggerEnter/Exit functions; don’t forget to look stuff up on the scripting reference when you’re not sure about it.