A* Moving Example and Integrations (Behavior Designer)

Hey! Having a bit of trouble with adapting the moving ship example to some scenarios. I’ve had success with using Behavior Designer’s Movement pack with A* moving ship example, having spawned enemies navigate waypoints or pursue other operations on a moving platform. It’s really great! But I’m trying to integrate BD’s Tactical pack and running into issues. When I’ve had issues with A*, it’s always been some version of the below error block. Local Space Rich AI having some trouble talking to the graph I believe? I’ve had this pop up seemingly at random and have to revert to an earlier version of the scene at times, but that may be unrelated.

For the Tactical pack, I’m replace AI Path with Local Space Rich AI, and including the RVO Simulator on the scene’s A* object as well. The RVO Controller on any Agent properly recognizes that it’s Shape attributes are driven by Local Space Rich AI. Also including Local Space Graph on the plane being used, like the Ship example.

Any thoughts on how to troubleshoot this? Any idea if A* Moving implementation should work with all integrations or may be hit and miss? Thanks!

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.Examples.LocalSpaceRichAI.RefreshTransform () (at Assets/AstarPathfindingProject/ExampleScenes/Example13_Moving/LocalSpaceRichAI.cs:39)
Pathfinding.Examples.LocalSpaceRichAI.CalculatePathRequestEndpoints (UnityEngine.Vector3& start, UnityEngine.Vector3& end) (at Assets/AstarPathfindingProject/ExampleScenes/Example13_Moving/LocalSpaceRichAI.cs:50)
Pathfinding.AIBase.SearchPath () (at Assets/AstarPathfindingProject/Core/AI/AIBase.cs:480)
Pathfinding.RichAI.SearchPath () (at Assets/AstarPathfindingProject/Core/AI/RichAI.cs:252)
BehaviorDesigner.Runtime.Tactical.AstarPathfindingProject.Tasks.IAstarAITacticalGroup+NavMeshTacticalAgent.SetDestination (UnityEngine.Vector3 destination) (at Assets/Behavior Designer Tactical/Integrations/Astar Pathfinding Project/Tasks/IAstarAITacticalGroup.cs:57)
BehaviorDesigner.Runtime.Tactical.AstarPathfindingProject.Tasks.ShootAndScoot.OnUpdate () (at Assets/Behavior Designer Tactical/Integrations/Astar Pathfinding Project/Tasks/ShootAndScoot.cs:129)
BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree, System.Int32 taskIndex, System.Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus previousStatus) (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorManager+BehaviorTree behaviorTree) (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.BehaviorManager.Tick () (at <58623c9461324266a5b7839460bb9d26>:0)
BehaviorDesigner.Runtime.BehaviorManager.Update () (at <58623c9461324266a5b7839460bb9d26>:0)

Still struggling with this, any insight on a path (lol bad pun) to go down for troubleshooting my issues here? Should this be working totally fine in theory?

Sorry for the double bump but I meant to tag @aron_granberg in my reply, thanks!

Hi

Sorry for the terribly slow reply.
Do you think you could post the exact line that throws the error? Line numbers vary a lot and I can’t tell exactly which part of the script throws the error just based on your stacktrace.

Are you sure you have assigned the Graph field of the LocalSpaceRichAI component?

Is the graph in the scene when the game starts?

Hi Aron,

Thanks for responding.

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.Examples.LocalSpaceRichAI.RefreshTransform () (at Assets/AstarPathfindingProject/ExampleScenes/Example13_Moving/LocalSpaceRichAI.cs:39)

graph.refresh seems to be having the problem. I am not able to figure out when or why it is able to see the graph properly. I have two scenes, one where it works and one where it doesn’t, that appear setup identically. My moving platform has LocalSpaceGraph on it. A* Pathfinder has scanned that platform / area and mapped it properly as far as I can tell. My character has Local Space Rich AI on it, is parented and placed on that platform and keeps throwing the above error.

Is there other information I should provide about my setup that is helpful?

Thanks,
Tyler

Hi

Thanks, but I meant showing the contents of the line that throws the exception. I can’t get all the information from the stacktrace because my line numbers are different from yours.

Do you have a screenshot of your LocalSpaceRichAI setup?

Thanks a bunch Aron, here are the related screenshots.







Oh, I know what this is.
I think due to a recent refactoring, the graph field has become invisible in the inspector.
This is how it is supposed to look:

That’s a very dumb mistake by me. Sorry for all the trouble it caused you.

I’ll release an update soon with the fix, but in the meantime you can work around it by putting the unity inspector in debug mode, which will make all fields visible, and then assigning the graph field to your LocalSpaceGraph instance.

Amazing, this is working, thanks a bunch Aron!

1 Like

Great to hear that @stylotylo!