#Unity Session : cannot repeatedly join the same room
1 messages · Page 1 of 1 (latest)
i already ensured the session ID of room B is always the same
the error is from
await MultiplayerService.Instance.JoinSessionByIdAsync(sessionID);```
this is first time
this is second time
the weird thing is
player actually joined into the session, because if u attempt to join the session again it will say
"player is already a member of the lobby"
If the last user leaves a session it will get deleted. Is the host still in that session?
yes
room B host didnt do anything , it exists all the time, its just player A exit and rejoin room B
i think i will take a short video to show the error tmr👍
you might need to call session.ReconnectAsync() if you are leaving and rejoining
i had taken a vid, maybe its some other errors? because thats just didnt feel like restrictions/connection error/rate limit at all
all of the leaving and rejoining feels fine until the error pops out
and i dont think reconnectasync works for me in this case, because if i need player to reconnect, i need to know player had joined the room right?
which means player cannot leave session so that cs getjoinedRoomByIDworks , and then i can use the ID to reconnect back
but if i do that the player will need to stay in the room until he went offline, that might be like 4 hrs+ , and it will keep occupy room slot , lets say a room of 4, 2 of the player joined and left, but then the room is still in 3/4 right?
If the player leaves the session, they should be showing in the lobby anymore. If the player isn't leaving properly, it might be waiting for the player to timeout
But to use reconnectasync, you would need to keep a list of sessions the player had previously joined, yea
btw any idea of why that error happened in the vid?
I don't know what index its referring to. Its weird that its a Lobby Exception. If the session is still alive then so should the Lobby
in fact i just checked the stacktraces
it seems that even tho the error is on JoinSessionByIdAsync call
the execution didnt even go inside the function/trace, it just stopped at the very surface of the function
i gonna check if network manager is the problem
no its not the problem
now it pops out this one
huh, if you are leaving the session with the relay connection, then you'll need to wait for the 10 second soft shutdown to complete before trying to start it back up
i dont think it relate to the index error
ohhhhhhh
i gonna test with 30 seconds span then
I believe there is an OnServerStopped event you can listen for
no thats not the case, this error happens only because of a temp code i put in to brute forcing the network manager to start lol
catch (Exception e)
{
if (e.Message.Contains("Index"))
{
NetworkManager.Singleton.StartClient();
}
LogManager.instance.LogErrorAndShowUI(e);
return;
}```
sry i just forgot that, the index error still there....
ignore the relay error