Networking and multiple cameras

I am trying to figure out what other code can be used to tell wether a second camera is mine when instantiating onto a server. Right now each player can control their own camera but now I am unsure how to set it up for multiple cameras. This code works fine for the main camera but the extra camera never gets disabled if it is not theirs on the server. One camera is the MainCamera and the other camera is just a new created camera. I figured with this code it would disable them both but it only does it for the main camera.

    function Awake() {



if (!networkView.isMine){ 



GetComponentInChildren(Camera).enabled = false; 


}


}

So your problem is, that GetComponentInChildren returns only 1 camera, which you disable. It is doing exactly what it’s supposed to do. What you want though, is a function that returns a list of all components of type camera, aka GetComponentsInChildren
Here is that code implemented:

//In your variable declaration
var tmpCamera:Camera;

//In your Awake function
for (tmpCamera in GetComponentsInChildren(Camera)) {
    tmpCamera.enabled = false;
}

Hope this helps, Benproductions1