Playmode options - Scene reload

Hello again,
currently turning off “scene reload” is not supported. Are there any plans for support? Every other asset we’re using is working fine with it, so A* is the last obstacle.

It would save us a lot of time, thanks!

1 Like

Also curious about that one.

If you mean live recompile, I can got partially working (at least saving the graphs between a live recompile) by using this script and making sure it executes before the A* stuff. For some reason my Rich AI get their destinations offset and become buggy, but new pathfinder objects work ok

using UnityEngine;
using Pathfinding.Serialization;
#if UNITY_EDITOR
using UnityEditor;
#endif

/// IMPORTANT!!!!
/// PLACE THIS SCRIPT ABOVE ASTAR IN THE SCRIPT EXECUTION ORDER IN PROJECT SETTINGS IN UNITY (EDIT MENU)
/// OR IT WILL NOT WORK!!!

public class AStarLiveRecompile : MonoBehaviour
{
    public AstarPath aStar;
#if UNITY_EDITOR
    byte[] aStarData = null;

    private void OnEnable() //MUST EXCUTE BEFORE ASTAR ENABLE IN ORDER FOR THE LIVE RECOMPILE TO WORK
    {
        if(aStar == null)
            aStar = GetComponent<AstarPath>();

        if (aStar != null && aStarData != null && EditorApplication.isUpdating == true)
        {
            AstarPath.active = aStar; //reset the global instance of AstarPath 
            aStar.data.DeserializeGraphs(aStarData);  
        }
    }

    private void OnDisable() 
    { 
        if(aStar != null && EditorApplication.isUpdating == true)  
            aStarData = aStar.data.SerializeGraphs(new SerializeSettings() { nodes=true,editorSettings=true });
    }
#endif 
}

Bump. Looking for a fully working answer.

Hi

Last time I tried, it was very hard to get the proper events the package required. I believe there were some issues that made it impossible to destroy unmanaged resources like NativeArrays in some situations. But things might have changed, I’ll look into it again.