Hello friends, I’ve been banging my head in the wall for a couple of hours with this:
I am making an editor extension and I have that Node class which has a lot of children classes. I also have a List with all the nodes. At first I had the problem that this list didn’t survive through serialization (when I hit play all the children specific data was lost, including their Type). I read a lot of crap about Serialization and I finally managed to fix it by simply making the Node class driven by ScriptableObject. Though that ended up coming at a huge cost, because that means I can’t create nodes with new Node(), but with CreateInstance. For me that’s acceptable, but for my buddy - the XmlSerializer it isn’t, since who am I to tell him how to Deserialize his objects…
Long story short - XmlSerializer uses the Node() constructor and ScriptableObject doesn’t like that so I’m looking for a way to make my Nodes list survive ‘assembly reload’ or whatever happens when I hit play
without the making them ScriptableObjects.
Things I can’t do:
- Ain’t no way I’m replacing XmlSerializer because I’m inlove with it
- Also I can’t make multiple Lists for each type of nodes because that would fuc…screw up the entire code logic (which is a lot of junk to fix, believe me)
- I also really don’t want to create another Node class that won’t be driven by SO and also keep the old one for editor purposes
I’m aware that this question has kind of been asked before about 50 times but I didn’t find an acceptable solution. Also it’s worth mentioning that everything related to my editor extension is in a custom namespace if that makes any difference.
Please help me if you know a solution, I really am stuck. Also I need to get some sleep, I’ll check back here tomorrow.
Thanks in advance guys