OnCreateGameFailed

So when I am playing my game I change fields(rooms) and when i first login i am able to join a room with a player. When the first player goes to a room it works fine. Then I move and i get this error:

createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {}.
UnityEngine.Debug:LogError(Object)
PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:168)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:796)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:946)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:77)

This only happens on Photon Server LoadBalancing but not Photon cloud. This also didnt happen just yesturday. Im not even trying to create a game at any point.

Code when changing rooms:

[code2=csharp]using UnityEngine;
using System.Collections;

public class LoadScreen : MonoBehaviour
{
private int m_LoadState = 0;
AsyncOperation m_LevelLoader = null;
public string m_LoadLevelName = "";
public string m_LoadRoomName = "";

// Use this for initialization
void Start ()
{
GameObject networkObject = GameObject.FindGameObjectWithTag("network");
m_LoadLevelName = networkObject.GetComponent<LevelManager>().levelName;
m_LoadRoomName = networkObject.GetComponent<LevelManager>().roomName;
}

// Update is called once per frame
void Update ()
{
switch(m_LoadState){
case 0:{
if(PhotonNetwork.room == null){
m_LoadState = 1;
}
else{
PhotonNetwork.LeaveRoom();
m_LoadState = 5;
}
break;
}
case 1:{
PhotonNetwork.JoinRoom(m_LoadRoomName);
m_LoadState = 6;
break;
}
case 2:{
if(m_LevelLoader == null)
{
m_LevelLoader = Application.LoadLevelAsync(m_LoadLevelName);
}
break;
}
}
}

void OnGUI()
{
if(m_LevelLoader != null)
{
GUI.Label(new Rect(10, 400, 300, 20), "Loading: " + (m_LevelLoader.progress*100) + "%");
}
}

void OnPhotonJoinRoomFailed(){
Debug.Log("Make Room");
PhotonNetwork.CreateRoom(m_LoadRoomName);
}

void OnJoinedRoom(){
m_LoadState = 2;
}

void OnJoinedLobby(){
Debug.Log("Connected to master");
m_LoadState = 1;
}
}[/code2]

Thank you

Comments

  • Tobias
    Tobias admin
    edited November 2013
    You can only create a room, if it doesn't exist yet. If it does, you can join it, unless it's full or closed.
    So that's what crate room and join room do.

    We have a third option: You can try to join a room and if that doesn't exist yet, it gets created. Check out PhotonNetwork.JoinRoom(string name, bool createIfNotExists) for that. It's in PUN v1.24.
    Downside: You have to set room properties when you are already in the room, while CreateRoom does this the moment the room gets created.
  • My Code is made so that if it fails to join a room then it uses the void OnPhotonJoinRoomFailed() which is called when joining a room fails. It does not just create without trying to join first. The point is that this works fine on PhotonCloud Server but not using My server running LoadBalancing (which did work) so im trying to find out why this has changed to give me an error now.
  • Ah, sorry. A misunderstanding.
    Then the question is: What changed since yesterday?