Find Child Of A GameObject, then disable the 'FirstPersonController' script.

Hi all,

I need to select the parent named ‘LEVELONE’ and then select the gameobject named ‘Player’ and disable the ‘FirstPersonController’ component on it.

I’ve already tried the following…

GameObject.Find("Player").GetComponent<FirstPersonController>().enabled = false;

but it doesn’t seem to work.
Any help would be appreciated!

Join in with our conversation in the comments!

Show me the hierachy of the gameobject in question with an image or something.


Behavior.enabled, which MonoBehavior.enabled is inherited from, only switches the calling of Update() on/off, as per the documentation:

Note that MonoBehavior is a class, of which an object is instantiated; you can’t disconnect it entirely in the sense that it disables the ability to call those of its methods you yourself defined.

If you want to do that, you can either check to see whether the script is enabled before your code calls one of its methods yourself, or you can enclose the content of your methods inside the script in if(this.enabled) {}.