void DeserializeNodeTree(Stream file, NodeResource deserializedParentNode, ref int bytesRead, bool debug, bool assemblyMode) { int childCount = deserializedParentNode.GetNumberOfChildren(); for (int i = 0; i < childCount; i++) { NodeResource node = NodeResource.DeserializeNode(file, ref bytesRead, debug, assemblyMode); deserializedParentNode.AddChildNode(node); DeserializeNodeTree(file, node, ref bytesRead, debug, assemblyMode); } }
public override void SetBytes(Stream file, int chunkLength, long offsetPos, bool assemblyMode) { int bytesToRead = chunkLength - BlockTypeLength; int bytesRead = 0; #if DESERIALIZE_ALL_NODE_NAMES bool readNames = true; #else bool readNames = false; #endif this.rootNodeResource = NodeResource.DeserializeNode(file, ref bytesRead, readNames, assemblyMode); DeserializeNodeTree(file, this.rootNodeResource, ref bytesRead, readNames, assemblyMode); if (bytesToRead != bytesRead) { Debug.LogError("Malformed node tree"); } }