AStarPathManager LoadGraphFromAsset() resets AStarPathChanges calling from editor code OnSceneSaved callback

Hello, I have an editor script that does some scene validation in EditorSceneManager.sceneSaved callback. Basically it validates if waypoints I placed are on the navmesh graph, and to ensure the path is always loaded I call
FindFirstObjectByType<AStarPathManager(FindObjectsInactive.Include).LoadGraphFromAsset()

However, this resets changes I made to the scene such as the Edge Simplification value. Is there a proper way to do this without it resetting? I tried OnSceneSaving, and also Editor Coroutine delaying the call by a second, which it still resets it back.

Hi

AstarPathManager is not a script included in this package. That must be yours.

In general, I would advise you to use AstarPath.FindAstarPath() in the editor, to ensure AstarPath.active is filled in, and graphs are deserialized.

When you are done with changes, do:

AstarPath.active.data.SetData(AstarPath.active.data.SerializeGraphs());
EditorUtility.SetDirty(AstarPath.active);