Child prefab want to disable parent script

Hi all, I have a issue where I have a prefab that is belongs to the FPS and I want to go through the prefab to disable a script of the FPS.

It goes like this, first when the games start, a prefab will be init and it will be attached to the parent(FPS). I have a script on the prefab. so when i select to start the script i want to stop a script that belongs to the parent, is it possible?

This is the line i used:
var player: GameObject; // FPS
player.GetComponent(FPSCameraController).enabled = false;

Apparent it works if i attach to a gameobject not attached as a prefab but it does not work when the script is attached to the prefab.

Hope that someone can help.

Hi Guys hope someone can help thanks.

You can use an object’s transform.parent property to access the parent object. From there, you can use GetComponent to access the parent’s script.