Got an error containing (not rejoining (JoinMode=1)) while trying to connect

Hello, i'm fairly new with photon and unity but could get photon to work with CustomAuth on my own webserver, got webhooks and all. What im doing right now server side is save the map on GameClose in a text file which save the State object. Once the client connect to the server with customauth, i attribute a uuid (from server) and the client then use that as UserId. Then the client try to load the game and last State he was saved in, but im getting this error:

Operation failed: OperationResponse 226: ReturnCode: -1 (Found inactive UserId '8742636b-f03b-40a9-9114-2cffd1b1ad0b', but not rejoining (JoinMode=1).). Parameters: {} Server: GameServer

Tryed to search google for more info and this forum about joinmode=1 but i get nothing. If anyone could light me up! :)

Comments

  • Maybe if i could ask this question in another way. I want to make a persistant world. The client can disconnect at any time and respawn at same place once he log back in. From client side im using CreateOrJoin if the map is not made. This seem pretty wrong to me since the map should be loaded directly from server but i dont know how to create those State file myself so im making it with client first. I *think* using reconnectandjoin instead of createandjoin could fix my problem with the joinmode=1 thingy, since the State act as if the player was disconnected and try to reconnect.

    Not sure if im right but should i do it this way:
    Create map with a personnal client (not published) and add actor directly server side anywhere i want to in a map State then the player can just connect using reconnectandjoin?

    If someone could tell me if im doing it correctly or not that would be good! :)
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2018
    Hi @Aenil,

    Thank you for choosing Photon!

    You have figured everything by yourself.
    You are doing pretty well for someone "fairly new with photon and unity".

    JoinMode 1 is the CreateIfNotExists mode. It should be used only for new actors joining the room. If the actor exists already inside the room in an inactive state then RejoinOnly mode should be used.
    The RejoinOnly mode is used in RejoinRoom(roomName) and ReconnectAndRejoin(). The ReconnectAndRejoin() should be used mainly for a quick rejoin scenarios, for instance to recover from an unexpected disconnect.
  • Dave_A
    Dave_A
    edited May 2021
    If I may follow up, because I'm also having trouble, would this be reasonable logic, in OnConnectedToMaster():
    if (PhotonNetwork.LocalPlayer.IsInactive)
    				PhotonNetwork.JoinOrCreateRoom(roomName, options, null);
    			else
    				PhotonNetwork.RejoinRoom(roomName);
    
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Dave_A,

    That code is wrong.
    Don't rely on LocalPlayer.IsInactive, IsInactive should be checked for remote players.
    See snippet here.
    You may get rid of errors by commenting them or making them warnings or info logs OR adjusting it properly by having a "wasInRoom" flag that is set in OnJoinedRoom and reset when explicitly leaving rooms.
  • Thank you!