Munchy2007

PunTutPart2_4

Jul 25th, 2016
11,232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. namespace PUNTutorial
  5. {
  6.     public class GameManager : Photon.PunBehaviour {
  7.         public static GameManager instance;
  8.  
  9.         void Awake()
  10.         {
  11.             if(instance != null)
  12.             {
  13.                 DestroyImmediate(gameObject);
  14.                 return;
  15.             }
  16.             DontDestroyOnLoad(gameObject);
  17.             instance = this;
  18.         }
  19.  
  20.         void Start()
  21.         {
  22.             PhotonNetwork.ConnectUsingSettings("PUNTutorial_Pt1");
  23.         }
  24.  
  25.         public void JoinGame()
  26.         {
  27.             RoomOptions ro = new RoomOptions();
  28.             ro.maxPlayers = 6;
  29.             PhotonNetwork.JoinOrCreateRoom("Default Room",  ro, null);
  30.         }
  31.  
  32.         public override void OnJoinedRoom ()
  33.         {
  34.             Debug.Log("Joined Room");
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment