hey guys Any Idea why photon isn’t connecting?
(yes i have gone through the setup wizard)
using UnityEngine;
using System.Collections;
public class PhotonConnectScript : MonoBehaviour {
string _gameVersion = "1";
void Awake()
{
PhotonNetwork.autoJoinLobby = true;
}
public void Connect()
{
if (PhotonNetwork.connected)
{
// #Critical we need at this point to attempt joining a Random Room. If it fails, we'll get notified in OnPhotonRandomJoinFailed() and we'll create one.
PhotonNetwork.JoinRandomRoom();
}else{
// #Critical, we must first and foremost connect to Photon Online Server.
PhotonNetwork.ConnectUsingSettings(_gameVersion);
}
}
void OnConnectedToMaster()
{
Debug.Log("Connected to Master");
}
public void OnPhotonRandomJoinFailed (object[] codeAndMsg)
{
Debug.Log("CONGRATS CREATED A NEW GAME!");
// #Critical: we failed to join a random room, maybe none exists or they are all full. No worries, we create a new room.
PhotonNetwork.CreateRoom(null, new RoomOptions() { maxPlayers = 4 }, null);
}
public void OnJoinedRoom()
{
Debug.Log("CONGRATS JOINED ROOM!");
}
}