SHARE
TWEET

C# PN

a guest Nov 18th, 2018 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void SpawnPlayer()
  2.     {
  3.         GameObject MyPlayerGO = PhotonNetwork.Instantiate("PlayerTwo", new Vector3(0f, 0f, 100f), Quaternion.identity, 0);
  4.         MyPlayerGO.transform.Find("PlayerTwo/Camera").gameObject.SetActive(true);
  5.         GetComponent<PhotonView>().RPC("SpawnPlayerRPC", PhotonTargets.AllBuffered, Player.MyPlayer.nick, MyPlayerGO.GetComponent<PhotonView>().viewID);
  6.     }
  7.  
  8.     [PunRPC]
  9.     public void SpawnPlayerRPC(string nick, int pvID, PhotonMessageInfo pmi)
  10.     {
  11.         GameObject NewPlayerGO = PhotonView.Find(pvID).gameObject;
  12.         NewPlayerGO.name = "Gracz_" + nick;
  13.         Player player = Player.FindPlayer(pmi.sender);
  14.         player.gameObject = NewPlayerGO;
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top