- Home /
 
               Question by 
               LemurusBalok · Apr 17, 2018 at 05:31 PM · 
                networkingcallbacklan  
              
 
              Where should I override the Network Manager Callbacks?
I have implemented my version of the NetworkManagerHUD using the Canvas UI Elements. But I am Lost about how to call the Network Manager Callbacks like OnStartHost, OnStartClient, and OnStopClient.
Here is my Implementation
  using UnityEngine;
  using UnityEngine.Networking;
     
     [RequireComponent(typeof(NetworkManager))]
     public class NetworkManagerHUD : MonoBehaviour
     {
         #region UI Elements
     
         public GameObject HostButton;
         public GameObject JoinButton;
         public GameObject StopButton;
     
         public GameObject IPField;
     
         #endregion UI Elements
     
         private NetworkManager networkManager;
     
         private void Awake()
         {
             networkManager = this.GetComponent<NetworkManager>();
             StopButton.SetActive(false);
         }
     
         #region UI Events
     
         public void Host()
         {
             if (!NetworkClient.active && !NetworkServer.active)
             {
                 networkManager.StartHost();
     
                 HostButton.SetActive(false);
                 JoinButton.SetActive(false);
                 IPField.SetActive(false);
                 StopButton.SetActive(true);
             }
         }
     
         public void Join()
         {
             if (!NetworkClient.active && !NetworkServer.active)
             {
                 networkManager.StartClient();
     
                 HostButton.SetActive(false);
                 JoinButton.SetActive(false);
                 IPField.SetActive(false);
                 StopButton.SetActive(true);
             }
         }
     
         public void SetIP(string IPAddress)
         {
             if (!NetworkClient.active && !NetworkServer.active)
                 networkManager.networkAddress = IPAddress;
         }
     
         public void ServerOnly()
         {
             if (!NetworkClient.active && !NetworkServer.active)
                 networkManager.StartServer();
         }
     
         public void Stop()
         {
             //if (NetworkServer.active || NetworkClient.active)
             {
                 networkManager.StopHost();
     
                 HostButton.SetActive(true);
                 JoinButton.SetActive(true);
                 IPField.SetActive(true);
                 StopButton.SetActive(false);
             }
         }
     
         #endregion UI Events
     }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                