internal static void DeserializeReferences(Pathfinding.Serialization.GraphSerializationContext ctx) { int count = ctx.reader.ReadInt32(); for (int i = 0; i < count; i++) { var linkID = ctx.reader.ReadUInt64(); var startNode = ctx.DeserializeNodeReference(); var endNode = ctx.DeserializeNodeReference(); var connectedNode1 = ctx.DeserializeNodeReference(); var connectedNode2 = ctx.DeserializeNodeReference(); var clamped1 = ctx.DeserializeVector3(); var clamped2 = ctx.DeserializeVector3(); var postScanCalled = ctx.reader.ReadBoolean(); GraphModifier link; if (usedIDs.TryGetValue(linkID, out link)) { var link2 = link as NodeLink2; if (link2 != null) { if (startNode != null) { reference[startNode] = link2; } if (endNode != null) { reference[endNode] = link2; } // If any nodes happened to be registered right now if (link2.startNode != null) { reference.Remove(link2.startNode); } if (link2.endNode != null) { reference.Remove(link2.endNode); } link2.startNode = startNode as PointNode; link2.endNode = endNode as PointNode; link2.connectedNode1 = connectedNode1; link2.connectedNode2 = connectedNode2; link2.postScanCalled = postScanCalled; link2.clamped1 = clamped1; link2.clamped2 = clamped2; } else { throw new System.Exception( "Tried to deserialize a NodeLink2 reference, but the link was not of the correct type or it has been destroyed.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data."); } } else { throw new System.Exception( "Tried to deserialize a NodeLink2 reference, but the link could not be found in the scene.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data."); } } }