Quantcast
Channel: Questions in topic: "il2cpp"
Viewing all articles
Browse latest Browse all 598

,Cannot deserialize object of class from imported library by json.net

$
0
0
,In Unity project I have some class WsMessage for WebSocket interaction. This class located in my own library WebSocketModels. namespace WebSocketModels { [Serializable] public enum WsMessageType { System, Player, Challenge, DeclineChallenge, RemoveChallenge, Game, Move, Moves, Chat, Players, Challenges, Games, Clock } [Serializable] public class WsMessage { public WsMessageType type { get; set; } public string data { get; set; } public WsMessage() { } public WsMessage(WsMessageType type, string data) { this.type = type; this.data = data; } } } By some reason it cannot be deserialized using JSON.NET. I didn't see any errors. If i move this class from library directly to Unity project object of WsMessage creating normally. I use this simple command for get an object of WsMessage: WsMessage message = JsonConvert.DeserializeObject(inputWsMessage); I've met this problem after change my Unity player Scripting Backend to IL2CPP. On Mono everything was OK. Example of JSON content {"type":10,"data":"[{\"id\":\"0d8648e4-ce15-4084-87f9-f3de2b5a9b32\",\"fromPlayer\":{\"id\":\"af76e7c3-27b2-4d05-bcd3-f4b41c3bb7ba\",\"name\":\"Aydar\",\"rating\":1600.0,\"isOnline\":false},\"color\":0,\"timeControl\":{\"time_range\":10,\"time_increment\":5,\"control_type\":0},\"toPlayer\":null}]"}

Viewing all articles
Browse latest Browse all 598

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>