C# disable 2 diffirent scripts OnTriggerEnter

Hello, Im trying to disable 2 diffirentscripts when entering my keypad(its a OnTriggerEnter) and enabling them when clicking on the GUI button Ok after typing in the code to open the door. The scripts I want to disable is the SmoothMouseLook script which I got on my FPScontroller and the other script I want to disable is on my camera which is a MouseLook script (my Camera is a child of my FPS controller). How would I write if I want to access both of them and disable them OnTriggerEnter? I tried putting GetComponent().enabled = false; but Im getting an error, Object reference not set to an instance of an object.

Anyone can help me out here?

The two questions are essentially the same; when OnTriggerXX fires you have a something like col : Collider; with “col” you have access to the GameObject and can walk the hierarchy, such as

col.gameObject.GetComponent<SmoothMouseLook>().enabled = false;
col.gameObject.transform.GetChild("childNodeName").GetComponent<MouseLook>().enabled = false;

change childNodeName to be the name of the child node in your player hierarchy that the camera is attached to. Adjust any syntax nuances as needed, the above is off the top of my head.