public bool RemoveGraph (NavGraph graph) {
//Safe OnDestroy is called since there is a risk that the pathfinding is searching through the graph right now,
//and if we don't wait until the search has completed we could end up with evil NullReferenceExceptions
graph.SafeOnDestroy ();
int i=0;
for (;i<graphs.Length;i++) if (graphs[i] == graph) break;
if (i == graphs.Length) {
return false;
}
graphs[i] = null;
UpdateShortcuts ();
return true;
}