I recently started working with a project that had a custom graph and graph editor that took a reference to a game object from the scene. With A* 3.8.2 the objects were serialized without any issues and I was able to play the simulation. Upon upgrading to pro 4.8.2, the game objects will no longer serialize correctly and upon running the simulation I’m faced with null reference errors. Were there major changes to how objects were serialized between the different versions?
Sorry for the late answer. I have been traveling and have not been able to answer support requests for some time.
There might have been a few minor changes. Are you sure your reference is marked with the JsonMember attribute?
public class TilemapGraph : NavGraph
[JsonMember] public Tilemap tilemap;
protected override IEnumerable<Progress> ScanInternal()
Debug.Log(tilemap); // Returns Null when entering playmode.
Here’s the editor for good measure:
[CustomGraphEditor(typeof(TilemapGraph), "Tilemap Graph")]
public class TilemapGraphEditor : GraphEditor
public override void OnInspectorGUI(NavGraph target)
var graph = target as TilemapGraph;
graph.tilemap = EditorGUILayout.ObjectField("Tilemap", graph.tilemap, typeof(Tilemap), true) as Tilemap;
I’m on Unity 2022.2.2f1 using A* 4.2.17 Free Version.
As a side note, I just started using this today and everything has been incredibly easy, props! Everything else I’ve been able to find on my own but this one seems more like a bug, hence the “beginner question”.
Sorry, the package currently only supports deserializing a limited number of unity component references. You could instead serialize a reference to a GameObject or a Transform instead, and then use GetComponent on that.