Search Unity

Third Party Photon Network would delete all objects with PhotonView on them.

Discussion in 'Multiplayer' started by IWooDyI, Feb 2, 2015.

  1. IWooDyI

    IWooDyI

    Joined:
    Mar 26, 2014
    Posts:
    2
    Hello guys!

    Please help!

    I have a fairly simple project that I'm working on:

    FPS-Two player game.
    Players spawn at different end of the map, not problem.
    I can even run with them for 5~10 seconds. Everything is smooth.

    But for some reason Objects(Players, and other few objects with PhotonView) would disappear from the scene, about 10 seconds in to the game....

    I have absolutely no idea what is the reason for that.

    Please help.
    Thanks
     
  2. IWooDyI

    IWooDyI

    Joined:
    Mar 26, 2014
    Posts:
    2
    Found out that function OnDisconnectedFromPhoton is called....
    Still have no idea why.
     
  3. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    Yeah, it's a default feature of Photon to clean up objects on the network or something. Often clients are automatically disconnected if X amount of packets are dropped. You can mitigate this issue with something like PhotonNetwork.MaxSendsBeforeTimeout or something (I forgot the exact name) and setting it higher to be more tolerant.

    Another possible solution is finding the event that's called when a client disconnects and removing all photonviews from their units. Then you can keep your objects existing but upon reconnection, they will need to be reregistered to the server.
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
  5. OldTownEntertainment

    OldTownEntertainment

    Joined:
    Aug 23, 2015
    Posts:
    1
    Maybe you can use
    void OnDestroy() {
    print("Script was destroyed");
    }

    to reinstantiate a similar objects