Showing results for 
Search instead for 
Did you mean: 

Unity JsonUtility can't find constructor on build

Level 2

Hi all, I'm trying to manage a bunch of simple API calls via Json and the system works fine on Editor but when I build and play on the Oculus any time it should serialize or deserealize a Json it returns this error :


Saying it could not find the constructor for the class to deserialize. I have researched that maybe Unity is stripping the constructors on Android builds because the utility is using reflection and doesn't find any references to those constructors so I tried using "Preserve" and "JsonConstructor" attributes as the error suggest, turning of the stripping of code and making some "fake" direct calls to the constructors from the code with no result.

Any ideas what could be wrong?