network camera big problem

Hi

I'm making a multiplayer fps based on Third Person Networking Sample. I can spawn many characters and kill each other, it works perfectly. But when someone die, automatically this dead player can see through other player camera. And when he respawn, the camera doesn't change...

I mean, after a player die, respawn and can't use it's real camera, but another player's camera.

Please, i must tell the game to never show the camera of another player.

Thanks you so much!

Your game is instantiating a camera for every player. The oldest camera automatically renders on top, so when yoru player dies, his camera suddenly becomes the newest, and renders on the bottom, below your other cameras.

Having a camera for every player will seriously mess with your framerate, so you need to set your prefab to delete all but the proper camera.

In each prefab, add the following script:

C#:

public class CamDest : MonoBenaviour
{
public transform cam;
public void Start()
{
if (this.networkView.isMine == false)
{
Destroy(cam);
}
}
}

JS:

public var cam : Transform;
public function Start()
{
if (this.networkView.isMine == false)
{
Destroy(cam);
}
}

Hope this helps -- Flynn

EDIT: Written from memory, untested. May require tweaking.