I am slightly going mad.

Options
So I've been working on this unity project, and it worked all fine until the other day. Now its like PUN2 wants to drive me mad.
Either the room creation goes to infinity or both players can't see each other, even though they are in the same room (proof by name on textbox in the game)

i don't know why this happens, I bet in the end its just my internet...

Here's my network code.

public class NetworkManager : MonoBehaviourPunCallbacks
{
public LoadingScreen loadingScreen;
public Text testText;

private void Awake()
{
loadingScreen = GameObject.Find("LoadingScreen").GetComponent();
}

void Start()
{
DontDestroyOnLoad(gameObject);
}

public void ConnectToServer()
{
Debug.Log("Connecting to master server");
PhotonNetwork.ConnectUsingSettings();

loadingScreen.ShowLoadingScreen();
}

public override void OnConnectedToMaster()
{
Debug.Log("Connected to master server");

PhotonNetwork.LoadLevel("MainMenu");
PhotonNetwork.JoinLobby();
}

public override void OnJoinedLobby()
{
loadingScreen.HideLoadingScreen();

Debug.Log("Joined Lobby");
}

public void JoinRoom()
{
PhotonNetwork.JoinRandomRoom();
loadingScreen.ShowLoadingScreen();
}

public override void OnJoinRandomFailed(short returnCode, string message)
{
Debug.Log("Creating room");

PhotonNetwork.CreateRoom("game-" + Guid.NewGuid(), new RoomOptions { MaxPlayers = 8 }, TypedLobby.Default);
}

public override void OnJoinedRoom()
{
testText.text = "Joined Room - " + PhotonNetwork.CurrentRoom.Name + " / " + PhotonNetwork.CurrentRoom.PlayerCount;

PhotonNetwork.LoadLevel("Game");
loadingScreen.HideLoadingScreen();

}
}
ConnectToServer()
and JoinRoom() are called by buttons.

For testing purposes all I do in the "Game" scene right now, is photon-instantiate a cube with only a photon view attached because I kind of backwards engineered my project to find the mistake, it HAS to be in here :(

Comments

  • I think this is happening to a few people.
  • yeah, looking at the other posts here it seems like it.

    btw I would like to give everyone a tip when it comes to using photon with Playfab, I noticed you NEED to write your code so that the photon token is aquired BEFORE it joins a lobby.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    See my post here.