Support Forum

Accessing classes outside of the Pathfinding namespace

I’ve tried to access the Player class from AIDestinationSetter it with and without namespaces, but to no avail. What do I need to do to be able to access it?

Hi

The package uses Unity assembly definition files (https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) which means you will not be able to access anything else. You can remove the .asmdef files in the package and it will probably work, however to minimize issues when you upgrade the package I would recommend that you copy the contents of the AIDestinationSetter into a new script that you modify in any way you like.

1 Like

Gotcha! Thanks for the quick reply.

Sorry to necro this, but what if I wanted to add a field to AstarData for my custom GridGraph ( I want to be able to call AstarData.active.data.turnBasedGraph )? Right now I am using a separate script to query all the graphs in active.data and return any turnBasedGraphs, is this best practice?

I’ve tried removing the .asmdef file but this caused a lot of errors that I can’t decipher.

Thanks!

Sounds like the best solution. Or you could use AstarPath.active.data.FindGraphsOfType(typeof(MyCustomGraphType))

See https://arongranberg.com/astar/docs/astardata.html#FindGraphOfType
and https://arongranberg.com/astar/docs/astardata.html#FindGraphsOfType

1 Like

Solution in my case: Unable to access Using Pathfinding; - #20 by waltermandelbrot