Unity3dSampleTemplate
Unity3dSampleTemplate copied to clipboard
JsonException: No parameterless constructor defined for 'Nethereum.Unity.RpcModel.RpcParametersJsonConverter'.
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:
- Using 2021.x / 2022.x / 2023.x unity versions
- Using different versions and packages from the Nethereum releases.
- Using either Tasks or Coroutines.
Any ideas? Thanks in advance.
Getting the same problem with Unity WebGL
This is an issue with build code stripping set it to minimal