A* Pathfinding Project

RichAI Repositions actors in Build but not in Play


I’m in the early phases of a project and have AStar working fine in Play mode (in Unity debugging). Each enemy has a RichAI and a Seeker component and the scene itself has an AStar Path with a Recast graph. Using FleePaths and RandomPaths I’m able to make enemies move appropriately, and setting targets allows them to pursue the player as well. It’s all working as expected.

The problem is that when I generate a Win x86 build and run that, something moves the objects to positions around 0 X and 0 Z when this does not happen in the play mode.

I attribute this to AStar (or at least in part) because when I disable the RichAI component of an actor, build the game and play the built game, this movement does not occur.

I do have a cocktail of other assets involved, most notably I’m using nodeCanvas to power a behavior tree that will send signals to the Seeker attached to a RichAI.

Has anyone seen anything at all like this? I’m wanting to release a first preview build of a game, but 0, 0 happens to be inside of a force field in my game, so it makes the playable demo a bit odd if the enemies are constantly constrained and protected.



Do you get any error messages in the game log?
One common issue is that you are using static batching for some meshes. Due to Unity limitations the pathfinding script cannot access those meshes outside the unity editor if that is the case. It would have logged an error message about this in the game log if this is the case.
You can circumvent this by caching the graph (https://www.arongranberg.com/astar/docs/save-load-graphs.php).