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 on PUN.

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.

Disconnecting from Photon?

SaravanaKumar
2013-11-11 10:20:15

Hi,

So, I can't able to create room again.

Here is my scenario in Workers Demo example:

Can you tell me how to disconnect when i press back button from InGame.? :?:

createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {}. UnityEngine.Debug:LogError(Object) PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:170) NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:802) NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:952) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[]) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:76)

Comments

Tobias
2013-11-12 15:14:30

You can use PhotonNetworking.Leave() to not disconnect but leave the room. Or you can use PhotonNetworking.Disconnect(), which will require a PhotonNetwork.ConnectUsingSettings() again.

SaravanaKumar
2013-11-29 09:12:11

I disconnected from the room and PhotonNetwork successfully.

public void OnPhotonPlayerDisconnected(PhotonPlayer player) function will be called after player disconnected/leave from Room.

But, In My scenario After one player is disconnecs/leaves the room means the list need to updated. I will call one function which refreshes

playerlist. But it contains RPC Functions. So, I can't able to call inside OnPhotonPlayerDisconnected()[Calling inside the

OnPhotonPlayerDisconnected will leads to crash Unity].

Where could i call to refresh to playerlist. So, that others can know how many players are active/available.

Tobias
2013-12-02 14:11:38

Which player list? Photon Unity Networking has a built-in player list but that is of course kept up to date for you. You don't have to manipulate that one. If you built your own, I can't really help, cause I don't know the code and what you do. In worst case, make sure the next Update() loop will call some method to clean your player list.

Back to top