public static void DestroyItem(int networkId) { var serDe = new SerDeDestroyItem { NetworkId = networkId }; Broadcast("DestroyItem", JsonUtility.ToJson(serDe)); }
private void OnDestroyItem(SerDeDestroyItem serDe) { if (!_items.ContainsKey(serDe.NetworkId)) { Debug.LogError("Item not found: " + serDe.NetworkId); return; } var item = _items[serDe.NetworkId]; if (item != null) { Destroy(item); } _items.Remove(serDe.NetworkId); }