Open xmedeko opened 5 years ago
Not using Reflection.Emit
just nullifies the performance on restricted platforms. I don't have a fast option for this.
I understand that the solution is slower, but I prefer to have at least some working solution for more platforms event it would be slower on some platforms. IMHO if you put some warning into the project documentation, that the performance is degraded on IL2CPP platforms, then it's OK.
+1 for the request, I am using a library that has fastJSON as dependency and Google Play Android Store requires x64 builds, which can only be built with il2cpp scripting backend. Will try the solution by xmedeko, hope it works.
FYI/FWIW I was able to successfully use CSV parsing with Unity IL2CPP by manually binding instead of using reflection. It was a bit more work but once it was done it worked great. My entire game is built on top of CSV files.
FYI/FWIW I was able to successfully use CSV parsing with Unity IL2CPP by manually binding instead of using reflection. It was a bit more work but once it was done it worked great. My entire game is built on top of CSV files.
So cool...
When using IL2CPP compiler (AOT - Ahead Of Time), then
JSON.ToObject
fails with:System.NotSupportedException: System.Reflection.Emit.DynamicMethod::.ctor
.This is a problem for platforms like Unity3D, Xamarin and others, see #46, #49, #60
The problem is, the
DynamicMethod
must not be used in theReflection
. Please, make some switch (e.g.#if ENABLE_IL2CPP
) to have workingReflection
for IL2CPP, too.I've made a fork to fix this issue https://github.com/xmedeko/UnityFastJSON but the code may not be optimal. Use the last commit in the repo only.
Also, user @iodev has made the changes a while ago, see the fork https://github.com/iodev/fastJSON/tree/master/fastJSON%20UWP but it seems unfinished.