I’m trying to make a system working so that I can enable/disable “Flags” and colliders will turn on/off depending on whether their flag is currently active. This is so I can block off certain portions of the story until they meet a specific requirement.
The problem I’m having is getting a collider to check if it’s flag has been activated/de-activated. I need it to be a string I can type in because I intend on having many flags and colliders which will use this, so I need to be able to type in which flag I need to be checked in the inspector, and have the script take it from there.
The example is: I assign the below script to a collider and I type in which Flag it needs to check in order for it to disable. I enable the triggers so the object can become walk-throughable, but currently, if I press “l” nothing happens at all.
var FlagNeeded = "";
function Update () {
if(FlagControl.FlagNeeded == true){
collider.isTrigger = true;
}
if(Input.GetKeyUp("l")){
FlagControl.Flag01 = true;
}
}
And this goes on the FlagControl, which handles all of the flags.
static var Flag01 : boolean = false;