The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Disconnecting when join or create a room

WanChen
2022-12-04 19:27:26

When i try to join or create a room , the client will get disconnected.

I used PhotonNetwork.JoinOrCreateRoom and the return was true, but no callback was called.

This is the log message:

private void Start()

{

if (DebugMode)

{

roomName = "Debug";

Initialize();

}

}

public void Initialize()

{

PhotonNetwork.ConnectUsingSettings();

}

public override void OnConnectedToMaster()

{

Debug.Log("ConnectedToMaster");

PhotonNetwork.JoinLobby();

}

public override void OnJoinedLobby()

{

Debug.Log("JoinedLobby");

CreateOrJoinRoom();

}

public void CreateOrJoinRoom()

{

RoomOptions options = new RoomOptions { MaxPlayers = 2 };

Debug.Log("CreateOrJoinRoom");

bool a = PhotonNetwork.JoinOrCreateRoom(roomName, options, default);

Debug.Log(a);

}

public override void OnJoinedRoom()

{

Debug.Log("JoinedRoom");

PhotonNetwork.Instantiate(player.name, Vector3.zero, Quaternion.identity);

}

public override void OnCreatedRoom()

{

Debug.Log("CreatedRoom");

}

public override void OnCreateRoomFailed(short returnCode, string message)

{

Debug.Log("CreateRoomFailed");

Debug.Log(returnCode);

Debug.Log(message);

}

public override void OnJoinRoomFailed(short returnCode, string message)

{

Debug.Log("JoinRoomFailed");

Debug.Log(returnCode);

Debug.Log(message);

}

Comments

Tobias
2022-12-05 10:09:06

Those logs are for Photon Voice, not PUN. For some reason, the Voice client gets disconnected.

Maybe you are not using the correct AppId for it. The type of the Voice app should be "Voice" and if it's Fusion (e.g.) this would disconnect you.

WanChen
2022-12-05 11:15:29

I found the problem. The time-out leads to the disconnect. How can i solve it?

Tobias
2022-12-05 14:34:01

It looks as if your client is not receiving anything.

Check your firewall if it blocks the port (the log should contain the IP and port, too). Also try the alternative ports. Check if your antivirus or ISP randomly have one of our IPs on their block lists (this happened earlier but it's impossible for us to check or prevent this).

Back to top