/// <summary>Helper function for deserializing graphs</summary> void DeserializeGraphsPartAdditive(Pathfinding.Serialization.AstarSerializer sr) { if (graphs == null) { graphs = new NavGraph[0]; } var gr = new List <NavGraph>(graphs); // Set an offset so that the deserializer will load // the graphs with the correct graph indexes sr.SetGraphIndexOffset(gr.Count); if (graphTypes == null) { FindGraphTypes(); } gr.AddRange(sr.DeserializeGraphs(graphTypes)); graphs = gr.ToArray(); sr.DeserializeEditorSettingsCompatibility(); sr.DeserializeExtraInfo(); //Assign correct graph indices. for (int i = 0; i < graphs.Length; i++) { if (graphs[i] == null) { continue; } graphs[i].GetNodes(node => node.GraphIndex = (uint)i); } for (int i = 0; i < graphs.Length; i++) { for (int j = i + 1; j < graphs.Length; j++) { if (graphs[i] != null && graphs[j] != null && graphs[i].guid == graphs[j].guid) { Debug.LogWarning( "Guid Conflict when importing graphs additively. Imported graph will get a new Guid.\nThis message is (relatively) harmless."); graphs[i].guid = Pathfinding.Util.Guid.NewGuid(); break; } } } sr.PostDeserialization(); active.hierarchicalGraph.RecalculateIfNecessary(); }