Function triggers in a disabled script

Hi all!
I have just started playing with Unity and I have come across this problem: I have a script containing OnCollisionExit function attached to an object with rigid body component. Everything works fine except when I disable the script component. Actually the engine ignores the “enabled” flag in the component and executes the commands in the mentioned function on collision regardless of whether the script is enabled or not. It doesn’t happen with Update function though.

Am I missing something out or is this normal? Thanks for the responses.

Here’s the code:

function OnCollisionExit(col:Collision){

    GetComponent("Rigidbody").useGravity = false;
	
}

add a Debug.Log(“this script gets trigger”) to your script and make sure it’s that script that gets triggered.

If my memory is good, enable only affects Start, Update and OnGUI functions.

And the rest works ? :?

@appels: when Debug.Log() is inside update function it doesn’t show up, but it does when it’s inside the collision one.

@AkilaeTribe:that’s right, update function is properly disabled, just the OnCollision* is always triggered. It’s not really a problem, I just wanted to be sure it’s normal.

Thx guys :slight_smile:

good to know :slight_smile: