Using "public void OnDisconnected ()"

Hello. Sorry for wasting your time but I am a noob! (total noob! even in c#).

After Connecting to a server:
public override void OnConnectedToMaster () { }

I'd liked to use:
public void OnDisconnected () {}

to trigger some events (methods) ... So as a dumb I turned off my Wi-Fi but method is not triggered (a simple Debug.Log saying "Your Connection with Server is Lost").

What Am I doing wrong? I was expecting that message to pop out in my console!



  • Hi @Funesto,

    You are probably extending
    so you need to override OnDisconnected(DisconnectCause) like did for OnConnectedToMaster.
    public override void OnDisconnected(DisconnectCause)
        Debug.Log("Your Connection with Server is Lost");
    And you may need to wait up to 10 seconds (client timeout period) for the disconnection callback to be triggered in some cases.
  • Hello @JohnTube
    Thanks for your reply! ... :| :| this is magic! I swear you I spelled right that exact code before asking ... I had to to a copy paste from your lines to get those accepted!

    :-) Thanks!!!!
Sign In or Register to comment.