Pathfinding without UI

I’m trying to create a graph without a visual representation. So just create a gridgraph programmatically, fetch the path and handle the drawing manually.

However when I try to call the Astarpath.active in Start() I get a null ref. Are there any components I need to have in the scene to make it work?

This really seems like the best way to make ECS work with a*, that way I can save the next waypoint in a component and simply have a system that keeps track of the next waypoint and the target.

Thanks for a great product.

Hi

Do you have an AstarPath component in the scene?

No. I guess thats the trick, right?
There is no way to init it without it?

If you don’t have the component in the scene you can always create it using a script.

AddComponent<AstarPath>();

You may also be interested in https://arongranberg.com/astar/docs/runtimegraphs.html

Yes, I’ve read that.
Many thanks for the quick reply.

1 Like