Simple question about accessing a component

This should be an easy one for you experts out there… :slight_smile:

I am simply trying to enable a script that is on the Main Camera from another script that is also on the Main Camera.

So I have the Camera Controller script, in which I am trying to enable the mouselook script if a key is pressed. Shouldn’t I just be able to say:

GetComponent<MouseLook>().enabled = true;

Since the script is already attached to the main camera? How do I access that main camera and enable that other script because the above isnt working.

Bonus Points:

As you might have guessed, I am trying to switch to a First person view by pressing a key and I want to enable mouse look. If you have a better theory on how to do this and you feel like sharing I am all for it :slight_smile: I already have implemented a way to zoom the camera in, now I just need the mouse look to be able to look around.

I don’t think you can get a disabled component with GetComponent, but I don’t have time to test it right now. Try storing the reference to the components before disabling them, at start typically.