Adding multiplayer networking
To make the scene run as multiplayer, we need at a minimum a Network Manager component and we need to identify any objects that will get spawned using the Network Identity component.
Network Manager and HUD
First, we'll add the Network Manager component, as follows:
- Create an
Empty
game object and name itNetworkController
- Select
Add Component
|Network
|Network Manager
- Select
Add Component
|Network
|Network Manager HUD
We added a Network Controller HUD
which displays a simplistic default menu, in screen space, that Unity offers to select the runtime networking options (you can see it in the images that follow). It's for development. In a real project, you'll probably replace the default HUD with something more interesting. And for VR, you'll want to make yours in world space.
Network Identity and sync Transform
Next, add a Network Identity to the Avatar
prefab. We will also add a Network Transform, which instructs the networking system to synchronize the player...