You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default Unity serializes public fields, as does LitJson. However the rules are a little more complicated. It should be possible to configure LitJson to directly mimic the serialization behaviour of Unity, most specifically to train it to respect the SerializeField attribute. (Note that this should be done without introducing a compile-time dependency between LitJson and UnityEngine, but rather by having a way to dynamically inject an attribute type or delegate to control what gets serialized.)
Unity will serialize the following types:
any Unity object
any custom class (but not struct) marked with System.Serializable attribute
basic value types (string, float, int, etc.)
Lists and arrays of serializable types
On these objects, the following will be serialized:
public fields of serializable types
private fields marked with the UnityEngine.SerializeField attribute
For insight, I'd suggest switching to text-based meta files and opening a file in notepad. Unity serializes all it's objects using the YAML format, which IIRC is a superset of Json, so developing a strategy here should be straightforward.
The rules are simple enough, as outlined above. Right now there's no way to tell LitJson to serialize private fields, or to look for the SerializeField attribute. (I just hacked support for this into my local branch, but it's not done cleanly.)
By default Unity serializes public fields, as does LitJson. However the rules are a little more complicated. It should be possible to configure LitJson to directly mimic the serialization behaviour of Unity, most specifically to train it to respect the SerializeField attribute. (Note that this should be done without introducing a compile-time dependency between LitJson and UnityEngine, but rather by having a way to dynamically inject an attribute type or delegate to control what gets serialized.)
Unity will serialize the following types:
On these objects, the following will be serialized:
More information on serialization from the Unity tech blog.
The text was updated successfully, but these errors were encountered: