The [Serializable] header is not necessary for class JSON serialization, but documentation says it is
Many tutorials show the [Serializable] header on classes that will be serialized, but I am successfully using the JsonUtilitiy.ToJson() and JsonUtility.FromJson() calls in my game without that header. I am confused by this. Was this changed to an optional class header without an update to the documentation?
Example tutorial showing the need for the [Serializable] header - https://docs.unity3d.com/Manual/JSONSerialization.html
Documentation for System.Serializable (doesn't mention the header being required for JSON serialization at all) - https://docs.unity3d.com/ScriptReference/Serializable.html
Answer by spymatt · May 22, 2019 at 01:26 PM
@Shadoninja The JSON utility also supports MonoBehaviour and ScriptableObject derived classes, which would not need the [Serializable] annotation.