Search Unity

Unity 5.1 Hooking onto NetworkManager messages?

Discussion in 'Documentation' started by ArchAngel075, Jul 12, 2015.

  1. ArchAngel075

    ArchAngel075

    Joined:
    Jul 12, 2015
    Posts:
    2
    Reading over the new 5.1 networking manager - Ive noticed there is no real explanation on how to properly access the NetworkManager's 'hook' methods such as 'OnStartServer' or 'OnStartClient' or 'OnStartHost'.

    Each lists itself as a hook that is called when abc happens, yet I am unsure how exactly to create the hook outside of registerHandle(MsgType, method) - but not all message types are there, there is no such one for Server/Host creation.

    Would anyone please explain what exactly I should go about doing?

    note : Unsure if this really falls under Documentation, as it is a somewhat 'lack of documentation on how to do do hooks' issue
     
  2. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    I believe you would just override those methods and do your own thing. Something like:

    using UnityEngine.Networking;

    public class MyHooks: NetworkManager {
    public override void OnStartClient(NetworkConnection conn)
    {
    Debug.Log ("OnStartClient");
    }
    }