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

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

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.

Can't start OFFLINE mode while connected!

2021-02-25 13:08:00

So I'm currently trying to make player able to create a single-player room. My current code to set offline mode to true looks like this:

However, when I set it to true, it gives me "Can't start OFFLINE mode while connected!" which makes no sense to me because I checked and this error gets thrown when IsConnected is true and it is true even in offline mode. So how can I possibly resolve this?

Thanks in advance!


2021-02-25 22:08:24

Looking at my own code here, it seems that if you're connected you need to disconnect before starting an offline game.

2021-02-26 13:15:51

Thanks, but I already figured this out on my own and did it the same way using Coroutines. So, for anyone reading this in the future, what do you need to know when implementing offline mode:

  1. Don't connect to master after going offline

  2. Create room without joining lobby as it will throw up an error otherwise

  3. Disconnecting doesn't happen immediately, so you might want to use something like this:

2021-03-04 15:33:03

Disconnect will attempt to reach the server and tell it the client disconnects. This makes sure the remaining players know asap.

There is a callback which tells you when the client is disconnected, so you don't have to make this a coroutine (but it's OK).

Back to top