Only activate scripts when game is toggled to the first person controller

My game toggles between a first and third person controller. I have a script on a cube which I only want to work when the game is in first person, and not to work in third person.

This is the script:

function OnMouseOver () 

{ rigidbody.velocity = transform.up * 05;

yield WaitForSeconds (5);

rigidbody.velocity = transform.up * 0;


After looking around on the forums, I still can’t work out how to change it so it is only activated in first person - I was wondering if anyone knew how to change it, or give me a pointer for what to look for?

Thanks so much, Laurien

ok your deactivating Character Controllers but you aren’t disabling the players themselves, so when you check it will always be true.

so for your cube script.

if(firstperson.GetComponent(CharacterController).active == true)

instead of