Skip to content

Feature: support field serialization consistent with Unity #9

@BBI-YggyKing

Description

@BBI-YggyKing

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
  • -not- properties

More information on serialization from the Unity tech blog.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions