using AX.Network.Protocols; using AX.NetworkSystem; using AX.Serialization; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Duration : MonoBehaviour { // Use this for initialization void Start () { } void OnEnable() { NetworkMessageDispatcher.AddListener("TIME_SYNC", UpdateDuration); } void OnDisable() { NetworkMessageDispatcher.RemoveListener("TIME_SYNC", UpdateDuration); } void OnDestroy() { NetworkMessageDispatcher.RemoveListener("TIME_SYNC", UpdateDuration); } private void UpdateDuration(BinaryMessage message) { var time = message.Body.Deserialize(); GetComponent().text = time; } // Update is called once per frame void Update () { } }