How to Account for: Operation failed: OperationResponse 226: ReturnCode: 32764 (Game closed)?

Options
I know what's causing this error, I am in fact causing it deliberately to stress test my lobby code. I have a game where I want the rooms to be visible to the player in a scroll list and then tap a room to join it.

So I figured it might be a problem if the player tries to join a room that just decided to start (or is full, and so on), so I decided to test it.

I get that error message; it pauses the editor, it does not appear to crash a deployed EXE, although I did not test the APK for Android.

However I would like to be able to "Okay, it clearly cannot connect, try/do something else." However that doesn't seem to be easily determinable. The function in question PhotonNetwork.JoinRoom() seems to always return true even though that error happens once it leaves the scope of the current function. So try-catch doesn't work either that I know of, it never joins the room, so I can't try to handle it there.

The alternative I guess, would be to check to see if the room is full etc, but I can't seem to see how to pull one particular room info easily but I am looking into it.

Suggestions?

Comments

  • jeanfabre
    Options
    Hi,

    there is a OnPhotonJoinRoomFailed for example that you need to implement to catch when joining a room failed.

    check out the ConnectAndJoinRandom script from the demos, you'll see how it catches a join failure and creates a room if that's the case. You'll need to adapt this, but this is basically how you do it. you may also need to catch when creating a room failed

    Bye,

    Jean
  • RaenirSalazar
    Options
    Thanks Jean! I'll look into it.
  • RaenirSalazar
    Options
    jeanfabre said:

    Hi,

    there is a OnPhotonJoinRoomFailed for example that you need to implement to catch when joining a room failed.

    check out the ConnectAndJoinRandom script from the demos, you'll see how it catches a join failure and creates a room if that's the case. You'll need to adapt this, but this is basically how you do it. you may also need to catch when creating a room failed

    Bye,

    Jean

    Okay so I tried it, and while it works and lets be "handle" the error I am still worried about the fact it still throws a Unity Error:

    http://i.imgur.com/QgLe6b5.png?1 <- Here, you see the error message in red? Can I suppress this?
  • OneManArmy
    OneManArmy ✭✭✭
    edited July 2016
    Options
    Hi, just double click on error and change:
    Debug.LogError(....)
    to
    Debug.Log(......)
    and problem solved.

    P.S. Actually it shouldn't even be an error, but warning.
  • RaenirSalazar
    Options
    I did that and it works, I'm just sketchy on messing with Photon's code directly. :D