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.

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.

Why do I get "Operation LeaveRoom (254) not called because client is not connected or not ready yet"

tetripod
2021-04-30 21:35:17

I've just completed the tutorial (overall pretty great, although I have to say it's a little weird that it just "ends" and doesn't at least do something like "Ok, now go to your launcher scene and let's run the whole thing!") and am now playing the game to test it all out. I'm getting the following error when a player is killed:

I scanned a couple other questions on the forum that got a similar error, and it seems like the reason for this is that a player is trying to leave a room but is not IN a room, and I'm not really sure how that would be. As far as I can tell I've followed the tutorial correctly line-for-line and didn't inject any of my own code. Has anyone experienced this and found a solution, or would anyone at Photon be able to help me identify if I missed something in the tutorial that would cause this? Definitely want to make sure I understand this concept before I start coding my own game...

Comments

tetripod
2021-04-30 21:36:31

Sorry, to be clear, this is the PUN2 tutorial and I'm in Unity.

JohnTube
2021-04-30 21:56:11

Hi @tetripod,

Please provide the full error message and the full stack trace.
Most likely this is due to clicking "Quit" or "Leave Room" button multiple times, first time it works fine, second time this error is thrown because the client is already Leaving or Left.

tetripod
2021-04-30 22:04:05

Hey @JohnTube , thanks for the quick response. Here's my stack trace:

FWIW, I'll mention that when I fire the beam it drains health on both the shooter and the victim, even though the beam collider is outside the collider for the player character as per the direction of the tutorial. I don't see how that would cause the player to try to leave the room twice, but I'm definitely not an expert so I may be overlooking/misunderstanding something.

JohnTube
2021-05-01 00:22:00

Hi @tetripod,

So checked the code, the stack trace does not lie and your hint about draining own health is on point.
So there are two different issues: the beams colliding with local player (source of beam). This should be fixed somehow. Not sure how to be honest (it's the weekend and I'm not the original author of the tutorial, I just helped porting it to PUN 2 and with the documentation and I know 'a bit' of PUN 2).
The other issue: when the health is equal or lower than zero, LeaveRoom should be called once.

One possible solution is to add a flag "leaving" when the first call to LeaveRoom is called...

PlayerManager.cs:

GameManager.cs:

tetripod
2021-05-01 03:30:42

Gotcha, ok. I'm going to file this under "Note to self: Write airtight logic for player departure" and start coding my own game with it in mind. Thank you!

Back to top