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

OnDisconnectedFromServer not fired

Discussion in 'Multiplayer' started by Gameccino, Sep 4, 2016.

  1. Gameccino

    Gameccino

    Joined:
    Aug 1, 2012
    Posts:
    40
    I'm trying to manage server crashes and network disconnection on the client side.

    Found on the docs that the method that should be fired on both server and client is OnDisconnectedFromServer(NetworkDisconnection) here:
    http://docs.unity3d.com/ScriptReference/Network.OnDisconnectedFromServer.html

    but making some test this method is never fired.

    How do you manage unexpected disconnection from server on the client side?
     
    hickna and MrLucid72 like this.
  2. lprancourt

    lprancourt

    Joined:
    Feb 1, 2016
    Posts:
    1
    I am somewhat bothered by the fact you have received 0 answers for this issue, did you find what the problem was? I can't help you, I came here because I have an issue similar to this.
     
    MrLucid72 likes this.
  3. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,117
    If you register a message for MsgType.Disconnect in NetworkServer or your NetworkClient then you will receive it, If you are using NetworkManager then you should inherit a class from it and override relevant methods.

    The class you mention is legacy for old unity networking not uNet.
     
    lprancourt likes this.
  4. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    962
    I noticed this too -- here are the callbacks you want (although careful - the explanations are sparse and doesn't really tell you the order fired):

    https://docs.unity3d.com/Manual/UNetLobby.html
     
  5. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    962