void DeserializeGraphs (byte[] bytes) { AstarPath.active.AddWorkItem (new AstarPath.AstarWorkItem (force => { var sr = new AstarSerializer(script.astarData); if (sr.OpenDeserialize(bytes)) { script.astarData.DeserializeGraphsPart (sr); // Make sure every graph has a graph editor CheckGraphEditors (); sr.DeserializeEditorSettings (graphEditors); sr.CloseDeserialize(); } else { Debug.LogWarning ("Invalid data file (cannot read zip).\nThe data is either corrupt or it was saved using a 3.0.x or earlier version of the system"); // Make sure every graph has a graph editor CheckGraphEditors (); } return true; })); // Make sure the above work item is run directly AstarPath.active.FlushWorkItems(); }