Type lost when entering Playmode or reloading Unity
Hi, I'm making a node graph using ScriptableObject
s in a custom editor window. So, I have a ScriptableObject
class called NodeGraph
.
NodeGraph
stores a bunch of Nodes, my nodes all have different behaviours so I decided to make a Plain C# class called Node
and decided to inherit from that for other nodes.
In this situation, my NodeGraph
keeps a list of all my nodes: List<Node>
. I add nodes to that list to keep track of them.
I have a node class named If
which inherits from Node
. These can both be stored to List<Node>
. At first, when I add an If
node, it behaves as it should.
A LOOSE example of how I'm doing this is seen here:
Which runs this method, adding the objects to my list:
At first... it works... my problem is that when I close Unity, or enter Play mode, it seems my type is lost. It stops acknowledging the If
type and treats it as a generic Node
without typecasting.
Is there some special things I need to consider when serializing a list of objects that perhaps make use of inheritence?