Casting a GraphView node using GetNodeByGuid() returns null

I’m trying to create a visual scripting tool using GraphView. I want different types of Nodes for the different options (Such as show message, add player EXP and so on).
All my nodes inherit from my rpg_EventNode class, which itself inherits from the GraphView Node class.

When I go to save my event, I create a list of rpg_EventNodes.


private List<rpg_EventNode>  _nodes => _eventGraph.nodes.ToList().Cast<rpg_EventNode>().ToList();

Then, when I’ve found the node I want to save, I need to cast it into it’s specific type.


foreach (var node in _nodes) 
   {
      switch(node.nodeType)
           {
               case 101 :
                  var messNode = (rpg_MessageEventNode) _eventGraph.GetNodeByGuid(node.GUID);
                           //Save node specific data
                  break;
                         //Annnnddddd so on.....

The problem is, this is returning null. Any ideas why?

Fixed it with this

 rpg_ChoiceEventNode choiceNode = (rpg_ChoiceEventNode)_nodes.First(x=> x.GUID == node.GUID);