Search Unity

UNET- send a message to the server when Client quits- detecting Client's disconnection

Discussion in 'UNet' started by nataliw, May 27, 2019.

  1. nataliw

    nataliw

    Joined:
    Jul 22, 2016
    Posts:
    6
    What's the function that you are using? i was trying OnApplicationQuit to contain a Cmd_SendAMessageToTheServer (under [Command]) in a script on LocalPlayer and it doesn't seem to work, any suggestions?

    I was trying to use OnDisconnectedFromServer(NetworkDisconnection), but I get an error saying that NetworkDisconnection has been deprecated in Unity 2018.2 (which I'm using)..

    Thanks

    N.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    When I was using Unet I would just use OnDestroy on the Player GameObject, since by default the Player object is immediately destroyed on the server when a client disconnects.
     
  3. nataliw

    nataliw

    Joined:
    Jul 22, 2016
    Posts:
    6
    Ha! Makes sense, was trying to over-complicate it. Lovely.