Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party Photon Unity Networking

Discussion in 'Multiplayer' started by tobiass, Aug 23, 2011.

  1. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    Have you checked my demo project on Pooling with Photon? it shows how to do this and indeed how you can totally choose the way to use prefabs resources using pool systems off the shelves or your own way.

    https://github.com/jeanfabre/Exitga...s/PoolManager/Scripts/PunPoolManagerBridge.cs


    Resources are only loaded when you say so, so you are responsible on how to use theses resources and no they will not be loaded with levels at all, they are only loaded on demand via your own logic ( or photon's logic in the case of network instantiation when not using pooling systems).

    Let me know if you need more help on this.

    Bye,

    Jean
     
  2. Nikolasio

    Nikolasio

    Joined:
    Dec 6, 2014
    Posts:
    59
    Hi,

    I'm looking for a way to instantiate a player in a room (left side screen for the player owner) and displaying this same player on another position (right side screen) for the other player to see.

    So basically, in a 2 player game, when you enter a room, your player is always displayed on the left side of the screen.

    Is this even possible?
     
  3. piginhat

    piginhat

    Joined:
    Feb 17, 2016
    Posts:
    96
    I am running on an Android device as master and also on editor on Mac OSX
    as client with PhotonNetwork.automaticallySyncScene = true;

    When I call PhotonNetwork.LoadLevel(2) it always takes over 127 seconds
    for the level to load on the device and then instantly on the editor?

    The loaded level is nothing more than a blank scene with a single cube in it.

    If I run the other way round, master on editor on Mac OSX and client on
    the device PhotonNetwork.LoadLevel(2) load the scene in under 3 seconds
    but does not load on the android device.

    I can seem to see why this is so....help anyone?

    Thanks
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Nikolasio: Everything is possible. It's just some coding. How about turning around the cam? It makes most sense, I would guess. Then the scene is consistent. Alternatively you can try to write the OnPhotonSerializeView() in a way that flips the sides.

    @piginhat: If the actual loading is taking so long, it's not a topic for this chat but likely a bug. Afaik, the Basic Tutorial is loading scenes. Did you try implementing that?
     
  5. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    @piginhat: If the actual loading is taking so long, it's not a topic for this chat but likely a bug. Afaik, the Basic Tutorial is loading scenes. Did you try implementing that?[/QUOTE]

    Currently in chat with Photonians.

    But to expand my model scene loads OK in an AR app, a basic 2 scene app and works OK. It is only when I add Photon to load the scene the delay appears.

    I have tested the demo app and loads perfect. Add my model...long long delay. But like I say, the model works perfectly OK in my other non Photon apps.
     
  6. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I'm getting warning:

    OnLevelWasLoaded was found on PhotonHandler
    This message has been deprecated and will be removed in a later version of Unity.
    Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
     
  7. Twitwi

    Twitwi

    Joined:
    Apr 11, 2012
    Posts:
    22
  8. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Currently in chat with Photonians.

    But to expand my model scene loads OK in an AR app, a basic 2 scene app and works OK. It is only when I add Photon to load the scene the delay appears.

    I have tested the demo app and loads perfect. Add my model...long long delay. But like I say, the model works perfectly OK in my other non Photon apps.[/QUOTE]

    Turns out (my bad) I had the model in question in the Resources folder where it should not have been. Thanks to Photon support for pointing this out.

    Problem solved
     
  9. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    255
    Hello, this system is also nin-Authoritative, like Unity? What happens with the events (e.g. when a new player joins?)
     
  10. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    https://www.photonengine.com/en-US/Chat

    Does this chat service run separately from the normal photon multiplayer networking?
    Can it handle 1000 players.
    So hard to explain lol.

    another way to word it.
    is the chat networking rooms completely separate networking from the game play networking.
    I'm making a MMO with photon networking but its actually instances with just a few people. so not a real MMO but I need the chat to be like a MMO.
    so I need a chat system that will network everyone to a single chat.
     
  11. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Is there a common bug with Photon networking where eventually a GameObject with a PhotonView component attached to it gets destroyed? I've noticed my character eventually gets destroyed after being idle for a while. I don't even have anything in my game logic that does that I don't think. I;ve noticed this over the last few months with a few different games I've been making too.

    According to my log it seems they just get destroyed when the server messes up?
    Or my internet messes up either one. Idk which.
    I know I need to kick the player out of the game or do something while he is having connection issues. Idk why it would destroy everything though?
    Is it possible to get it to stop destroying stuff?
    Or do i have to reload everything if the player lags out?


    Code (csharp):
    1. OnStatusChanged: DisconnectByServer current State: Joined
    Code (csharp):
    1. OnStatusChanged: Disconnect current State: Disconnecting
    Code (csharp):
    1. Network destroy Instantiated GO: Shadowing

    Code (csharp):
    1.  
    2. OnStatusChanged: DisconnectByServer current State: Joined
    3. UnityEngine.Debug:Log(Object)
    4. NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1922)
    5. ExitGames.Client.Photon.EnetPeer:ExecuteCommand(NCommand)
    6. ExitGames.Client.Photon.<>c__DisplayClass57_0:<ReceiveIncomingCommands>b__0()
    7. ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    8. ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    9. PhotonHandler:Update() (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
    10.  

    Code (csharp):
    1.  
    2. OnStatusChanged: Disconnect current State: Disconnecting
    3. UnityEngine.Debug:Log(Object)
    4. NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1922)
    5. ExitGames.Client.Photon.<>c__DisplayClass148_0:<EnqueueStatusCallback>b__0()
    6. ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    7. ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    8. PhotonHandler:Update() (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
    9.  

    Code (csharp):
    1.  
    2. Network destroy Instantiated GO: Shadowing
    3. UnityEngine.Debug:Log(Object)
    4. NetworkingPeer:RemoveInstantiatedGO(GameObject, Boolean) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3270)
    5. NetworkingPeer:LocalCleanupAnythingInstantiated(Boolean) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1115)
    6. NetworkingPeer:LeftRoomCleanup() (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1080)
    7. NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2023)
    8. ExitGames.Client.Photon.<>c__DisplayClass148_0:<EnqueueStatusCallback>b__0()
    9. ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    10. ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    11. PhotonHandler:Update() (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
    12.  
     
    Last edited: Aug 27, 2017
  12. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    We just updated PUN to v1.86. It's a smaller update but contains important changes for console export and Unity 2017 support:

    v1.86 (30. August 2017)

    Fixed: The fallback thread implementation to always call SendAcksOnly, as long as isMessageQueueRunning is false. This keeps connections from timing out by sending ACKs and Pings as needed.
    Fixed: Compatibility with Unity 2017.
    Changed: In the PhotonServerSettings, you can now select any of the implemented Transport Protocols for Photon: UDP, TCP and WebSockets. WebGL will always use WebSockets and Xbox One has it available, too. If you want to use it on other platforms, you have to set the define WEBSOCKET and make sure the websocket dll exports to the target platform.
    Note: Check your PhotonServerSettings to make sure the (Transport) Protocol setting is valid after updating.
    Note: A few files were moved within the Unity project. The Editor should figure out they are moved and updated. If it logs errors about duplicate definitions, look up the location of the class in this package and remove the other.
    Updated: PUN to no longer uses obsolete enum values of the Photon library (dll).
    Added: tvOS to the meta settings of Assets\Plugins\Photon3Unity3d.dll.
    Updated: Photon3Unity3d.dll to v4.1.1.15. See Assets\Plugins\release_history.txt for details.
    Xbox One:
    Changed: This PUN version only allows WSS communication on Xbox One. A thin native library is used as wrapper for the platform implementation of WSS.
    Updated: The warnings/errors for UNITY_XBOXONE for the cases: "No authentication value", "Wrong authentication type", "XSTS token not set for authentication" and "Not using WSS".
     
  13. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    yes, they run on their own, and has a different dashboard, app Id and you pay separately.

    chat sdk will handle 1000 players fine, because it's a different networking structure.

    so yes, there is not "room" in chat, only channels, so if you run both PUN and chat, it's not because you join a room in PUN that the chat sdk will be aware of it, it will not, it's completely separate.

    in your case, yes using chat will be a good thing because all players will be able to communicate even if they are not inside the same pun room.

    On that matter, I started a while a go a PunChatClientBroker class that will connect and handle both connection with one unified API, maybe that could be interesting for your project? https://github.com/jeanfabre/Exitgames--Custom--Samples_U4

    Bye,

    Jean
     
  14. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    I am not aware of any issues with networked gameobject being destroyed out of the blue, given your logs, you got disconnected from the server and so yes in this case network gameobjects are destroyed.

    to check the cloud status, go to this page, if you are in doubt, it will tell you if the cloud is up or down.

    https://www.photonengine.com/status

    if you don't want this to happen, you can set photon to not destroy automatically and you will get a callback which will let you decide what to do with your networked gameobjects.

    more infos here:
    https://doc-api.photonengine.com/en...etwork.html#a6c6fb3cd57d7e2a13d1fc354db0c1fd7

    Bye,

    Jean
     
  15. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    @Jean-Fabre Thanks a bunch man. Thats all I needed to know.
     
  16. sonnyboy

    sonnyboy

    Joined:
    Oct 25, 2015
    Posts:
    10
    Hi,
    There are still a lot of errors coming up directly inside your classes bound to 2017.1 for your 1.86 version. I have to find all #if UNITY_5 definitions and swap them with 2017 and there are a lot of them there. Are you sure you have opened the latest Photon with Unity 2017?

    Thanks
     
  17. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @sonnyboy: I personally didn't but my colleagues checked Unity 2017.1 before we released 1.86.
    Can you name a few places and which platform you selected? And are you using 2017.1 beta, the release or a updated version?
     
  18. sonnyboy

    sonnyboy

    Joined:
    Oct 25, 2015
    Posts:
    10
    @tobiass

    I am using 2017.1.0p2. I created a fresh project and import your Photon PUN+ package from Unity AssetStore.

    First Problem :
    Assets/Photon Unity Networking/Plugins/PhotonNetwork/LoadbalancingPeer.cs(408,63): error CS0104: `Hashtable' is an ambiguous reference between `System.Collections.Hashtable' and `ExitGames.Client.Photon.Hashtable'
    As example bound to line :
    #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5 || UNITY_5_0 || UNITY_5_1 || UNITY_6
    using UnityEngine;
    using Hashtable = ExitGames.Client.Photon.Hashtable;
    using SupportClassPun = ExitGames.Client.Photon.SupportClass;
    #endif

    Second problem :
    Assets/Photon Unity Networking/Demos/DemoHub/Editor/PunStartup.cs(76,9): error CS0433: The imported type `UnityEditor.SceneManagement.EditorSceneManager' is defined multiple times

    Third Problem :
    Assets/Photon Unity Networking/Editor/PhotonNetwork/Views/PhotonAnimatorViewEditor.cs(82,16): error CS1061: Type `PhotonAnimatorViewEditor' does not contain a definition for `m_Controller' and no extension method `m_Controller' of type `PhotonAnimatorViewEditor' could be found. Are you missing an assembly reference?

    I have cleaned all those problems by simply swapping Unity_5 with Unity_2017 in all project as a quick solution but I think I have made mistakes on some necessary defining of version so the project failed to continue on play.

    Maybe you have cleaned the problems on free version but not on PUN+?

    Thanks
     
  19. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @sonnyboy: That file is outdated or not updated correctly. We no longer have a single "UNITY_6" define in our code. I also can't find it in PUN+ when I download it from the store. Please make sure the update went well.
     
  20. sonnyboy

    sonnyboy

    Joined:
    Oct 25, 2015
    Posts:
    10
    Hi @tobiass
    Somehow Asset Store was showing the package updated but it was not. I erasedthe old version from local drive and it downloaded the right version. Sorry for the trouble and thanks for your help!
     
  21. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @sonnyboy: Ah, that's confusing of Unity! Well, glad you found it. You're welcome - have fun!
     
  22. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @tobiass I have taken a look at the network culling demo shown here https://doc.photonengine.com/en/pun/current/manuals-and-demos/culling-demo

    Is it meant to work or just show an example of a bit of an approach to the problem? The reason I ask is that it seems to work a bit, but not very well. I end up with the Kyle characters standing next to each other on one instance and in a totally different place, often far apart in another instance. I would have expected that if the players were meant to be close to each other, then they really would be very much in sync.
     
    Last edited: Sep 11, 2017
    Munchy2007 likes this.
  23. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Baraff: I would expect the demo to work but I didn't test this one myself. We will have another look and check what's happening.
     
    Munchy2007 likes this.
  24. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Thanks @tobiass, that would be great to know that I am at least looking at a working example. This example would need changing to incorporate view culling for me, but not much point starting if it is currently broken code.
    FYI, I have been using 2017.1.0p5 based Unity's, in case that matters.
     
  25. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Baraff: It might matter, yes. We will have a look at Thursday and get back to you here.
    You are using PUN v1.86, I assume?
     
  26. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Thanks for the prompt! I totally thought I was already on the latest version. As it turned out, I was still on v1.85. So I updated and now it seems to work fine. So I would say to anyone who has this problem, if you are on v1.85, this demo is broken, but worked fine with v1.86 on my 5 minutes of kyle running around test. On v1.86 it was obvious it was not working very quickly.
     
  27. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @tobiass It seems I may have spoken too soon. I had forgotten that last time I looked at this I had removed the Network Culling Handler to to make sure the RPG demo was working at all. So my comment before was of course looking at the standard RPG demo which of course works. Tried it again with the component added and while it seemed better it was still possible to create a situation like this pretty easily. As you can see they are not in sync here. So it it seems to be broken still. In the image on the left the Kyle on right is controlled in this instance and can be seen next to the other Kyle, but in the image on the right, that Kyle is offscreen.

    upload_2017-9-13_6-9-30.png
     
  28. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Hmm. The subscribed cells are identical, which is good. We'll have to debug.
    Thanks for the updated input!
     
  29. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Baraff: We took a look and can confirm the demo was broken in v1.85 but works in v1.86.
    I'm not sure of we even noticed it now works again (as there is no note in the changelog).

    To anyone using Unity 2017: It seems there are potential issues with updating projects and importing packages. We checked compatibility with 2017 (but not the beta) so PUN works. If you run into issues, try importing into a new, empty project. In worst case, copy the files from there to your project in the explorer/finder.
     
  30. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @tobiass The test above was performed on 1.86 and it was still broken as you can see in the image I posted.
    I noticed that there was an update pushed last night called 1.86.1. There are no release notes for what was changed or fixed or patched but this update to 1.86.1 seems to fix the problem as far as I can tell from testing today.
     
  31. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Is there anything that Exit games makes that allows me to do a full serverside MMO using linux?
    I think there should be a bit of a change with how you guys advertise your server types. Its a bit confusing.
     
  32. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    That would be astonishing, as the .1 update is minimal and only relevant for some console exports. Unless you tested on those, there is no change that affects this demo but maybe the new import made the difference.
    Anyhow: Glad it's now working.

    @Shadowing: Photon Server does not run on Linux, so that's not a match. Otherwise, it would be a good basis for your project. It's in use by Albion Online, e.g., which has a lot of action.
    If you are OK to run Unity headless on Linux for an MMO, then you can use Bolt but we would guess it's too expensive to do (your game and Unity have to run really performant for that to be feasible).

    We're also not entirely happy with the way the products are explained. Some of this is .. difficult and there are always pro's and con's. Will have a look at it.
     
  33. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @tobiass Ah well just a Unity import hiccup then I guess. I did try deleting and reimporting just to be sure which just makes the confusion even worse when it still does not work. Anyway it seemed to work OK with the update, so go figure.

    Next item to address will be the random server disconnects which I have not even begun to look at yet. If you have any tips on possible things to look at, that would be appreciated. Possibly timeout related but that's just based on what I thought I saw in a log at some point while working on other things.
     
    Last edited: Sep 19, 2017
  34. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Baraff: Good the initial issue is gone. If you have disconnects, that might be related to debugging? When you pause all threads, that may happen?!
     
  35. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    I do see the debugging ones and they make sense. The random disconnects I am talking about however, just happen randomly. I have even seen it happen within the first few seconds. I can also complete a number of games that last around 10 minutes and not see the problem. Random events like this are not fun to find but any suggestions you may have would be helpful.
     
  36. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    That sounds like your network connection has some issue with Photon and I would like to take the opportunity to analyze this and not only work around it - if you're OK with that. No matter what, we should try out a few things, so please get in touch via mail: developer@photonengine.com
     
  37. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Email sent. Thanks
     
  38. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    We just released PUN v1.87. This contains several fixes and Russia (RU) as new region!

    Fixed: Basic Tutorial: remove obsolete warnings in Unity 5 and up versions for override of methods defined in PunBehaviour.
    Fixed: Demo hub doesn't throw anymore !dest.m_MultiFrameGUIState.m_NamedKeyControlList on Unity 4.7 and early version of 5 due to a Unity bug (https://issuetracker.unity3d.com/is...t-m-namedkeycontrollist-when-pressing-any-key).
    Fixed: Editor scripts for demos are now resolving "Photon Unity Networking" dynamically to allow for developers to move this folder around within the Assets. This applied to Demos and server settings handling.
    New: Best Region WhiteList dashboard link in ServerSettings.
    Updated: RPC calls allocate less memory.
    Updated: NetworkingPeer.ExecuteRPC() now takes Sender as ID instead of PhotonPlayer class, this change also allows sender to be unidentified wereas before it would throw an exception
    Added: Russia 'ru' as a selectable region.
    Added: Check for GameObject being null in RunViewUpdate(). There seems to be a rare condition in which this causes havoc.
    Added: SetExpectedUsers() for a Room.
    Fixed: Handling of Event "Error Info" (code 251). The content wasn't read and passed-on.
    Updated: To Photon3Unity3d.dll v4.1.1.17. See release_history.txt for details.
    Xbox One:
    Note: You must get the latest Xbox One "Addon" v1.87, as there are a fixes you should apply.
    Fixed: In the addon, the WebSocket implementation was fixed to avoid a crash bug when you disconnected and reconnected in quick succession.
    Fixed: In the addon, the Photon3Unity3D.dll was exchanged to be compatible with IL2CPP, Roslyn and .Net 4.6 as build settings. It's still compatible with Mono 2.x, too.
     
  39. Devio

    Devio

    Joined:
    Mar 13, 2016
    Posts:
    21
    Hey, I am currently getting .. Confusing errors. First being :
    https://prnt.sc/gwrp7d
    This also happens with the VoiceSpeaker.cs file. But easy fix just puts a @ before Help.
    The real problem becomes after it.
    http://prntscr.com/gwrpjf
    I have tried this on unity :
    2017.9.04b
    2017.2.0b11
    5.6.3f1

    They all cause problems, could I get some advice?
     
    Last edited: Oct 13, 2017
  40. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @Devio_ : You updated PUN into "PUN Voice", it seems. That's causing the issues, sorry. It seems to be an incomplete update.
    You might want to rollback and wait with the update until we updated the PUN Voice package.
     
  41. BrianND

    BrianND

    Joined:
    May 14, 2015
    Posts:
    79
    Could this exception be related to Photon or is it Unity? This is happening on a lot older and slower devices (ipad mini).

    I looked up the code and it seems to be related to
    Exception Type: 00000020
    Exception Codes: 0x000000008badf00d // infamous ate bad food exception code

    https://developer.apple.com/library/content/qa/qa1693/_index.html
     
  42. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    @BrianND: Receiving messages is not done on the main thread by Photon but sending is. We are not aware of it causing crashes but that doesn't mean it can't happen.
    Can you relate this to some use case? Like closing the app or some other situation?
    Maybe you can try a repro and build in a newer Unity version?
    If you can help with more info, get back to us via mail, please: developer@photonengine.com and let us know you refer to this thread.
     
  43. BrianND

    BrianND

    Joined:
    May 14, 2015
    Posts:
    79
    Thanks for the reply Tobiass I did a bit more research. I think it just has to do with the app taking too long coming back into the foregrounds state. If it takes too long then the OS will kill it with the 8badf00d exception. I don't think it's directly related to Photon. It might just have to do with older slower devices.
     
  44. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Ah, that could be the case, yes.
    Check out ReconnectAndRejoin(). It might help getting back into a game quickly.
     
  45. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    962
    I am getting this issue too after upgrading to Photon 1.87 with Unity 5.6.3

    EDIT: Fixed --
    Got it -- deleted VS project files and regenerated via Unity. I then had a Newtonsoft error, but renamed Newstonsoft.Json.dll to Newtonsoft.Json.dll.bak to do the trick (I have the Unity version already)
     
    Last edited: Oct 30, 2017
    tobiass likes this.
  46. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    when I call PhotonNetwork.Disconnect();

    OnDissconnectedFromPhoton never calls
    I do call Photonnetwork.Disconnect inside a static function though. Idk why that would matter though.
    I just updated to the latest version to and it still does it.

    Also i noticed that the console log says
    OnStatusChanged: Disconnect current State: Disconnecting

    But it never says dissconnected. So im guessing this is why.

    Code (csharp):
    1.  
    2.  
    3.     void OnDisconnectedFromPhoton() {
    4.         Debug.Log("OnDisconnectedFromPhoton()");
    5.        MyFunctions.ChangeScene("Start");
    6.     }
    7.  
     
    Last edited: Nov 1, 2017
  47. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Did you try to call Disconnect from a non-static method? It should not make a difference (or I am missing some knowledge about Unity)...

    You probably copy and pasted the code for OnDisconnectedFromPhoton() but a) make sure the spelling is right and b) make sure this is in a class extending MonoBehaviour. I think we don't callback on other types.
     
  48. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    No i haven't try a non static function yet. Ya the code i posted was copy and pasted. But ya did miss spell it the first time i forgot to add ed on Dissconnected. Its inside MonoBehavior theres no other wrappers around it either. What about the log? When I read the log it says disconnecting but it never says disconnected. Which makes me think it never finish disconnecting. Which is why it never calls that function.


    Code (csharp):
    1.  
    2. OnStatusChanged: Disconnect current State: Disconnecting
    3. UnityEngine.Debug:Log(Object)
    4. NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2042)
    5. ExitGames.Client.Photon.<>c__DisplayClass146_0:<EnqueueStatusCallback>b__0()
    6. ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    7. ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    8. PhotonHandler:Update() (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
    9.  
     
    Last edited: Nov 9, 2017
  49. Chintan-Kansagara

    Chintan-Kansagara

    Joined:
    Jul 16, 2016
    Posts:
    19
    hello
    unity3d WebGL game photon chat plugin not working.

    For UNITY_WEBGL, use protocol WebSocketSecure. Overriding currently set protcol Udp.
    UnityEngine.Debug:Log(Object)
    ExitGames.Client.Photon.Chat.ChatPeer:ConfigUnitySockets() (at Assets/PhotonChatApi/ChatPeer.cs:79)
    ExitGames.Client.Photon.Chat.ChatPeer:.ctor(IPhotonPeerListener, ConnectionProtocol) (at Assets/PhotonChatApi/ChatPeer.cs:46)
    ExitGames.Client.Photon.Chat.ChatClient:.ctor(IChatClientListener, ConnectionProtocol) (at Assets/PhotonChatApi/ChatClient.cs:182)
    ChatGui:Connect() (at Assets/Photon Unity Networking/Demos/DemoChat/ChatGui.cs:129)
    NamePickGui:StartChat() (at Assets/Photon Unity Networking/Demos/DemoChat/NamePickGui.cs:39)
    UnityEngine.EventSystems.EventSystem:Update()

    //==========

    Connect failed. SocketImplementationConfig is null for protocol WebSocketSecure: {(ConnectionProtocol)Udp=(MonoType)ExitGames.Client.Photon.SocketUdp, (ConnectionProtocol)Tcp=(MonoType)ExitGames.Client.Photon.SocketTcp}
    UnityEngine.Debug:LogError(Object)
    ChatGui:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Demos/DemoChat/ChatGui.cs:330)
    ExitGames.Client.Photon.Chat.ChatClient:ExitGames.Client.Photon.IPhotonPeerListener.DebugReturn(DebugLevel, String) (at Assets/PhotonChatApi/ChatClient.cs:800)
    ExitGames.Client.Photon.<>c__DisplayClass145_0:<EnqueueDebugReturn>b__0()
    ExitGames.Client.Photon.TPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.Chat.ChatClient:Service() (at Assets/PhotonChatApi/ChatClient.cs:269)
    ChatGui:Update() (at Assets/Photon Unity Networking/Demos/DemoChat/ChatGui.cs:163)
     
  50. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I would have to get a repro for this. As far as I know, our demos get a Disconnected message, so I don't know yet, what's wrong.

    I don't know why we didn't see that before. We will check that.
    Find NetworkingPeer.SetupProtocol(ServerConnection serverType) and compare this to ChatPeer.ConfigUnitySockets(). Make sure there's a SocketImplementationConfig set for WebSocket and WebSocketSecure.