Things I've learned about networking in Unity 5.1

In Unity 5.1 networking features were added.

In order to use them you'll want to create an empty game object. Next you will add a Network Manager component along with a network HUD component.
For any objects that you want to interact with and have loaded via network like a player you want to add the component Network identity.

This component has two flags, Server Only or Local Player Authority. Server only will have the object only live on the server. Local Player authority will have it be client only.

In your script you want to add a Using statement for Unity.Networking. Next you will want your class to inherit from NetworkBehaviour instead of MonoBehavior.
In your Update method you can have a check for if (!isLocalPlayer){return;} which will exit the update method if it's not the local player. This will prevent you from playing as multiple characters at the same time.


Comments

Popular Posts