Issue with DOTS (ECS) and Closed Subscene

Hi,

Until today I’ve been using the A* Pathfinding Project with DOTS successfully, so long as my subscene remains open. However, when I close the subscene, I can’t figure out a combination that gets it to work.

Previously working in DOTS:

  • Open subscene
  • Game object in subscene with AStarPath authoring.
  • Scan on awake is on.
  • All obstacles and agents in the subscene
  • Agents using physics body + physics shape + follower entity in authoring
  • DestinationPoint component for relevant entities updated by my own system to specify where to move
  • Graph visible in scene view on game start

Now when I close the subscene I get the following:

  • No visible graph
  • Despite DestinationPoint being updated, nothing happens with the agent. If I then manually through the runtime editor set Movement Control > Speed to say 5, and then update Movement Control > Target Point to a different value, they move directly there. This doesn’t involve actual pathfinding, but it at least moves the entity.

If I move the AStarPath object out of the scene view, I’m unable to scan the graph unless I open the subscene first. So, if I scan the graph with the subscene open, get the graph, then close the subscene (can still see in the scene until I run) and run:

  • Graph disappears from scene view (this happens with or without scan on awake in settings for astarpath on).
  • The following warning occurs:
    Error: Couldn’t find a node close to the start point
    Unique Path ID: 22
    UnityEngine.Debug:LogWarning (object)
    AstarPath:LogPathResults (System.Text.StringBuilder,Pathfinding.Path) (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:879)
    AstarPath:<.ctor>b__87_3 (Pathfinding.PathHandler,Pathfinding.Path) (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:684)
    Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler,Pathfinding.Sync.BlockableChannel`1/Receiver<Pathfinding.Path>) (at ./Packages/com.arongranberg.astar/Core/Pathfinding/PathProcessor.cs:373)
    Pathfinding.PathProcessor/<>c__DisplayClass27_0:b__0 () (at ./Packages/com.arongranberg.astar/Core/Pathfinding/PathProcessor.cs:122)
    System.Threading.ThreadHelper:ThreadStart ()
  • Manually overriding the Movement Control settings at this point doesn’t stay, as in it gets reset to the value it was previously. I can only assume this is because it’s being correctly updated now, but because there are no paths findable it gives up and stays put.

I’ve had to turn off the FollowerEntity Gravity setting, as it fights with the dots physics otherwise. Even with it on though, the same warnings and lack of pathfinding occurs.

When the AstartPath is outside the subscene and the scene is open I always get the same warnings and lack of pathfinding.

The only time I can get it to work is with AstarPath in the subscene with the other objects, and the subscene open. But when building it doesn’t work as that behaves the same as when the subscene is closed.

Edit: The object I’m using for the Ground has a BoxCollider, if I remove that box collider and instead use a physics body + physics shape, then the graph scan fails.

Happy to provide any further information if required.

Cheers,
Marcus

Hello!

This is because the package doesn’t support the Unity.Physics (DOTS physics) package. When the sub scene is closed, the game object colliders (default physics) doesn’t exist anymore. So the graph scanning doesn’t find anything to scan. The work around for now is to either save the scan data to a file and load that, or create a double of the colliders (so basically one with dots physics and ther other default physics) needed for the follower entities to navigate at runtime. Although you’ll probably need to create the default physics colliders again anyway so the npcs will have something to latch onto as them move about the game world.