Is it a way to disable a script 100%? I try to disable it, but something in the script
is still working. For example destroy the player.
But not exit level. I need to disable the exit script, so the
player is not destroyed when it touch the exit before
everything is picked up on the level.
I use this code:
function Start ()
{
//GetComponent(Exit).enabled = false;
}
The (commented) line you put there is exactly how you would disable a component. Seems like your action comes from another script. Or I didn’t get you right, in that case you would need to provide more details.
If I recall correctly, disabling a script just prevents Update() from being called. This fits the behavior seen here; the player is destroyed since OnTriggerEnter() still works, but the level never ends because the code for that is in Update(). At the top of all the other functions, return if the script is not enabled, like this.