Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MultiplayerClient : MonoBehaviour {
- public bool setup = false;
- public string clientName = "";
- private PhotonView myView;
- private PhotonView serverView;
- void Awake ()
- {
- if(GetComponent<PhotonView>().isMine)
- {
- setup = false;
- clientName = PhotonNetwork.player.NickName;
- myView = GetComponent<PhotonView>();
- JoinGame();
- }
- else
- {
- this.enabled = false;
- }
- }
- [PunRPC]
- public void SyncClientInfo(bool ready, string name)
- {
- setup = ready;
- clientName = name;
- }
- private void JoinGame()
- {
- //ConnectionObject = PhotonNetwork.Instantiate("ConnectionPrefab", Vector3.zero, Quaternion.identity, 0);
- myView.RPC("SyncClientInfo", PhotonTargets.AllBuffered, false, clientName);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement