Skip to main content
added 379 characters in body
Source Link
Heisenbug
  • 2.1k
  • 3
  • 24
  • 33

Unity's serializationserialization system doesn't support inheritance for custom serializable class. In order to correctly serialize fields of a polymorphic type it must be derived from MonoBehaviourMonoBehaviour or ScriptableObjectScriptableObject.

For your example BaseClass should extend MonoBehaviourMonoBehaviour to make it work.

In addition, custom serialized class references won't be resolved. This means that if 2 class A have a field referencing the same instance of a class B, the 2 field will be serialized separately and so you'll end up with 2 instance of class B one assigned to each field of the class A.

Unity's serialization system doesn't support inheritance for custom serializable class. In order to correctly serialize fields of a polymorphic type it must be derived from MonoBehaviour or ScriptableObject.

For your example BaseClass should extend MonoBehaviour to make it work.

Unity's serialization system doesn't support inheritance for custom serializable class. In order to correctly serialize fields of a polymorphic type it must be derived from MonoBehaviour or ScriptableObject.

For your example BaseClass should extend MonoBehaviour to make it work.

In addition, custom serialized class references won't be resolved. This means that if 2 class A have a field referencing the same instance of a class B, the 2 field will be serialized separately and so you'll end up with 2 instance of class B one assigned to each field of the class A.

Source Link
Heisenbug
  • 2.1k
  • 3
  • 24
  • 33

Unity's serialization system doesn't support inheritance for custom serializable class. In order to correctly serialize fields of a polymorphic type it must be derived from MonoBehaviour or ScriptableObject.

For your example BaseClass should extend MonoBehaviour to make it work.