我在Unity3D上使用JSON.Net 5.0r6序列化對象,dotnet 2版本。我可以在編輯器構建中的Webplayer模式下正常運行,但是當我部署到Webplayer時。我收到一個丟失的例外。我可以得到相同的代碼在Android上運行良好(沒有剝離),所以它不是代碼端。Unity3D中的JSON.Net中的MissingMethodException webplayer
MissingMethodException: Method not found: 'System.Collections.ObjectModel.KeyedCollection<System.String,Newtonsoft.Json.Serialization.JsonProperty>..ctor'.
at Newtonsoft.Json.Serialization.JsonObjectContract..ctor (System.Type underlyingType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe (System.Object value) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0
我得到了一些代碼,做原始字節數組打包,這是非常乾淨,如果你想要它? – War