What is the best option for serialization?
I've been developing a chess type game where each piece has specific stats. Each unit has one equipment slot, a list of traits, a list of effects, and a list of abilities. I am using an MVC format to the best of my ability.
I have a Model class that keeps lists of all the active units, tiles, equipment, items, abilities, and effects.
I then have a GameModel class that is serializable and holds all of the necessary lists for savings. Each of those scripts is also marked Serializable.
When I attempt to serialize I run into this error:
SerializationException: Type UnityEngine.MonoBehaviour in assembly UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as serializable.
is this because MonoBehaviours cannot be serialized?
If that is the case, what should I do? Should I rebuild my whole game to stay away from MonoBehaviour except for the most necessary bits?
Any help is greatly appreciated.
Can't serialize $$anonymous$$onoBehaviour. Separate the data you want to serialize from the $$anonymous$$onoBehaviour. Put the data you want to serialize into a serializable class or struct. Add a reference of the class/struct to the $$anonymous$$onoBehaviour.
Derp. Thank you for the clarification. I'm sure that is obvious to pretty much everyone else. :P