Nethereum / Unity3dSampleTemplate

Unity3d sample template to work with Nethereum
MIT License
87 stars 45 forks source link

JsonException: No parameterless constructor defined for 'Nethereum.Unity.RpcModel.RpcParametersJsonConverter'. #21

Open pabloruiz55 opened 1 year ago

pabloruiz55 commented 1 year ago

Hi! I'm experimenting the following issue when building to Android. Note that when running the game on the Unity player everything works fine, but when running on the device (Samsung Galaxy s22+) nothing is. Also, if building it for desktop Windows standalone, it also does work fine.

When trying to read or write from a smart contract (or even just request the block number from the examples) I get the following error:

04-19 09:46:36.921 32219 32274 I Unity   : UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
04-19 09:46:36.921 32219 32274 I Unity   :
04-19 09:46:36.941 32219 32274 E Unity   : JsonException: No parameterless constructor defined for 'Nethereum.Unity.RpcModel.RpcParametersJsonConverter'.
04-19 09:46:36.941 32219 32274 E Unity   :   at Newtonsoft.Json.Serialization.JsonTypeReflector+<>c__DisplayClass22_0.<GetCreator>b__0 (System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
04-19 09:46:36.941 32219 32274 E Unity   :   at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonConverter (System.Object attributeProvider) [0x00000] in <00000000000000000000000000000000>:0
04-19 09:46:36.941 32219 32274 E Unity   :   at Newtonsoft.Json.Serialization.DefaultContractResolver.SetPropertySettingsFromAttributes (Newtonsoft.Json.Serialization.JsonProperty property, System.Object attributeProvider, System.String name, System.Type declaringType, Newtonsoft.Json.MemberSerialization memberSerialization, System.Boolean& allowNonPublicAccess) [0x00000] in <00000000000000000000000000000000>:0
04-19 09:46:36.941 32219 32274 E Unity   :   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperty (System.Reflection.MemberInfo member, Newtonsoft.Json.MemberSerialization memberSerialization) [0x00000] in <00000000000000000000000000000

I've tried the following:

Any ideas? Thanks in advance.

eastedgeZack commented 4 months ago

Getting the same problem with Unity WebGL

juanfranblanco commented 4 months ago

This is an issue with build code stripping set it to minimal