decline-cookies / anvil-unity-core

Unity specific additions and extensions to Anvil
MIT License
2 stars 1 forks source link

Handle TinyJSON split across assemblies #33

Open jkeon opened 4 years ago

jkeon commented 4 years ago

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.

jkeon commented 4 years ago

Initial proof of concept in https://github.com/scratch-games/anvil-unity-core/tree/bug-33-tinyjson-refactor