Quantcast
Channel: Latest Questions by Kerihobo
Viewing all articles
Browse latest Browse all 74

Type lost when entering Playmode or reloading Unity

$
0
0
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`. 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`. 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:

![alt text][1]

Which runs this method, adding the objects to my list:

![alt text][2]

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?

[1]: /storage/temp/159961-add.jpg [2]: /storage/temp/159962-addnode.jpg

Viewing all articles
Browse latest Browse all 74

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>