using System.Collections; using System.Collections.Generic; using UnityEngine; using JXSoft; using LitJson; using System; public class UDPExample : MonoBehaviour,IUDPClient { // Start is called before the first frame update void Start() { this.RegisterMessageEvent(e => { Debug.Log(e.msg); }); this.onReceive(); } // Update is called once per frame void Update() { } } public class UResponseTest:AbstractJsonResponse { public string msg; public UResponseTest() { } public override bool trySetData(string json) { try { UResponseTest res = JsonMapper.ToObject(json); msg = res.msg; return true; } catch (Exception e) { Debug.Log(e); return false; } } }