INstantiate Camera Multiplayer

I want each player to be able to drop a portable camera that will show in the bottom left corner of the screen. It works except that the camera shows for all players at the same time. I just the camera to show only for the player that created it. I have some code that I was given for C4 which works great but not for the camera. Here is what I have so far:

var droppedCam : GameObject = null;

function Fire()
{
    [...]
    var instantiatedProjectile : Rigidbody = Network.Instantiate (projectile, transform.position, transform.rotation, 0) as Rigidbody;
    droppedCam = instantiatedProjectile.gameObject;
    [...]
}

I am assuming there needs to be something with enable and disable right? Maybe use isMine on the camera itself? Thanks for the help you guys.

I’m not an expert on network code, but here’s my idea:

(I’m running on the assumption that an object is only created over the network if you network instantiate it, not if you locally instantiate or add it. If this assumption is wrong, my answer is going to be useless)

First, edit your prefab and remove the camera from it. Now everyone on the network will see the world model for a deployed camera equipment, but it will have no function as of yet.

Next, when you create the camera, call droppedCam.SendMessage("setOwner", insertLocalNetworkPlayerHere); ////(I’m expecting this to be called on all the clients)//It might have to be BroadcastMessage

Then, add a new script to the prefab with


protected var owner : NetworkPlayer = null;
function setOwner(input : NetworkPlayer){   owner = input;   }

var screenArea : Rect;//the area on the screen the camera renders to
//insert other camera variables here

function Update()
{
    if(!this.camera && owner != null)
        if(owner == insertLocalNetworkPlayerHere)
        {
            this.AddComponent("Camera");
            this.camera.rect = screenArea;
            //set up all other camera variables here
            
            //The network Player has been assigned. Stop checking for updates.
               this.enabled = false;
        }else {this.enabled = false;}
}

If what I know about networking is right, and as long as you configure the network view correctly

(update NOTHING but the transform of this object, or better yet remove the network view and get creative with parenting to get this to react the same on all clients w/out using one)

this should create a camera on the client of the player that created the camera, and not any of the other clients.

Keep in mind that networking is not my forte, so use this at your own risk.