Support Forum

Pathfinding in editor scripts

Hey, I was trying to generate a graph to perform pathfinding on my custom waypoints at editor time and bake positions into a scriptable object.

I have tested graph creation on play-mode and everything works. I can create a point graph and perform pathfinding via seeker. Although, it does not work when I try to do the same thing via editor scripting without play-mode.

I get a NullRefException at AstarPath’s data property. I tried to attach a new instance to it but it didn’t change. Still null ref exception somehow.

I was hoping to get some help.


Edit: I have fixed it via calling “Scan” method before.