Enable the camera of a child

Sorry this is a dumb question but how do I enable a camera of a child? I have a target with a tag and that target has a camera attached to it. Just need to know how to enable to true. Something like this.

myTarget.GetComponent(Camera).enabled = true;

myTarget is parent and trying to get the camera to enabled true. This doesn’t work though.

Well, it’s actually a very common problem. Accessing Other Game Objects usually explains the basics very well. In general you can access a child with Transform.Find. If the component you want to access is the only one on this whole hierarchy (myTarget included), you can use GetComponentInChildren.

So either do:

myTarget.transform.Find("NameOfChildObjectWithCamera").camera.enabled = true;
//alternative:
myTarget.transform.Find("NameOfChildObjectWithCamera").GetComponent(Camera).enabled = true;

or

myTarget.GetComponentInChildren(Camera).enabled = true;

Thanks guys for your help this worked!!

myTarget.transform.Find(“Camera”).GetComponent(Camera).enabled = false;