Advertisement
Munchy2007

Unet5Tut1Pt3NetworkPlayer

Feb 15th, 2016
8,424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.Networking;
  4.  
  5. public class NetworkPlayer : NetworkBehaviour {
  6.     [SyncVar] public string playerID;
  7.  
  8.     [Command]
  9.     void CmdSetPlayerID(string newID)
  10.     {
  11.         playerID = newID;
  12.     }
  13.  
  14.     public override void OnStartLocalPlayer ()
  15.     {
  16.         string myPlayerID = string.Format("Player {0}", netId.Value);
  17.         CmdSetPlayerID(myPlayerID);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement