multiplayer with different cameras


I'm trying to create a multiplayer environment. It's not a proper game, this environment will be used for therapy and I need multiplayer support.

The problem is that I need the server to control the "therapist" (with a third-person camera) and the client to control an FPS controller (the one on the prefabs).

I'm following the tutorials at unity website about networking and also the tutorial from M2H.

The problem is that I can't create and use different cameras on the server and client.

What do you think?

Thanks for any help,

Did you review Networking Example? I think Car example will be help you ;)


As Vincenzo hints at, you should probably look at the Networking Example for an elegant solution to handling cameras in multiplayer.

In short, you don't need multiple cameras, you only need 1 camera, but you need to do different things (locally) with that one camera in each instance of the game.

For example, when a client connects to the game and his prefab is spawned, a script on his prefab should check in OnNetworkInstantiate() if he owns the networkView on the prefab, then check his peer type (if he is a client or a host), then enable/disable scripts and set targets accordingly on the main camera.

To this end, there will only be one camera across all instances of the network, but in my instance it will be following me (with the appropriate script enabled based on my peer type), and it yours it will be following you.