Attaching/Removing a script to main camera when player walks through trigger

Hey,

The map consists of two rooms - not attached to each other. When the user touches the trigger (in Room 1), they teleport to the other room (Room 2) - but it is at this point I want a script to attach to the main camera (it's a camera effect).

When they exit the room (Room 2), through a trigger, to Room 1, I want to remove the script (camera effect).

Essentially, how do you attach & remove scripts to the main camera using triggers?

Well assuming you already have a trigger that's set up and works for teleporting the player, something like this.

Room 1:

void OnCollisionEnter( other : Collider )
{
    // whatever you do to teleport the player

    Camera.main.AddComponent( "MyCameraEffectScript" );
}

Room 2:

void OnCollisionEnter( other : Collider )
{
    // whatever you do to teleport the player back

    MyCameraEffectScript myScript = Camera.main.GetComponent( "MyCameraEffectScript" );
    Destroy( myScript );
}