TinyJSON is located in the anvil-csharp assembly as we will want to use it for our serialization/deserialization.
However, in the class it includes #if ENABLE_IL2CPP which then includes the PreserveAttribute located in UnityEngine.Scripting
This presents a problem when making a build as the JSON class doesn't have reference to the UnityEngine assembly and therefore errors.
One solution could be just to modify the asmdef (which is App specific) to reference the UnityEngine Assembly and everything just works but this does make developing new anvil-csharp features a bit more tricky as you can accidentally include Unity things you're not supposed to.
Ideally there is a nice way to extend the JSON class in the anvil-unity assembly to include the Unity specific stuff.
TinyJSON is located in the
anvil-csharp
assembly as we will want to use it for our serialization/deserialization.However, in the class it includes
#if ENABLE_IL2CPP
which then includes thePreserveAttribute
located inUnityEngine.Scripting
This presents a problem when making a build as the JSON class doesn't have reference to the UnityEngine assembly and therefore errors.
One solution could be just to modify the asmdef (which is App specific) to reference the UnityEngine Assembly and everything just works but this does make developing new
anvil-csharp
features a bit more tricky as you can accidentally include Unity things you're not supposed to.Ideally there is a nice way to extend the JSON class in the
anvil-unity
assembly to include the Unity specific stuff.