using AX.NetworkSystem; using System.Collections; using System.Collections.Generic; using UnityEngine; using AX.Network.Protocols; using System; using AX.Serialization; public class ObjectDeleteSync : MonoBehaviour { // Use this for initialization void Start () { NetworkMessageDispatcher.AddListener("DELETE_SYNC", ObjDeleted); } private void OnDestroy() { NetworkMessageDispatcher.RemoveListener("DELETE_SYNC", ObjDeleted); } private void ObjDeleted(BinaryMessage obj) { var deleteID = obj.Body.Deserialize(); var gameObjectID = GetComponent().GameObjID; if (deleteID == gameObjectID) { EntitiesManager.Instance.DeleteObj(gameObject); } } // Update is called once per frame void Update () { } }