Hi,
I am new to PUN 2 and are making my way through trying to set up my first room. I have managed to setup my Unity project so it connects to the PUN 2 server. However when I try to CreateARoom, OnCreatedRoom() and OnJoinedRoom() do not get called. Am I doing something wrong?
Here is my code:
Any help would be greatly appreciated!
Thanks,
Dan
I am new to PUN 2 and are making my way through trying to set up my first room. I have managed to setup my Unity project so it connects to the PUN 2 server. However when I try to CreateARoom, OnCreatedRoom() and OnJoinedRoom() do not get called. Am I doing something wrong?
Here is my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Realtime; using Photon.Pun; public class CreateRoom : MonoBehaviourPunCallbacks { // Start is called before the first frame update void Start() { } public void OnClick_CreateRoom() { if (!PhotonNetwork.IsConnected) { Debug.Log("NOT CONNECTED TO PHOTON NETWORK"); return; } //Create the room RoomOptions options = new RoomOptions(); options.MaxPlayers = 4; PhotonNetwork.CreateRoom("test", options, TypedLobby.Default); UIManager.Instance.startScreen.SetActive(false); UIManager.Instance.roomScreen.SetActive(true); } public override void OnCreatedRoom() { Debug.Log("Created room successfully", this); } public override void OnJoinedRoom() { Debug.Log("Joined room successfully", this); } public override void OnCreateRoomFailed(short returnCode, string message) { Debug.Log("Created room failed: " + message, this); } }
Any help would be greatly appreciated!
Thanks,
Dan