So, I’m trying to serialize my Finite-State-Machine System I’ve built, but I’m having problems, because unity doesn’t support polymorphism serialization.
For instance, my State class has a
“protected IStateAction action;” declared, and that spot is to be used by a class inheriting that interface.
Okay, I know Unity doesn’t support polymorphism, I get that, but how am I supposed to do a custom serialization?
I have my serializer from our studio’s old engine (which BTW can serialize anything you throw at it, which was work of one week for me, I really don’t understand what is going on with the serialization on Unity), I have all it’s classes but there seems to be no event when there’s a scene save. I’ve thought about going around and serializing using my system to a byte, letting unity serialize that and then converting it to a MemoryStream, but I don’t have access to any event that I can use to know it’s time to serialize.