Scanning with a pathfinder in a prefab not working (2D)

So I am working with the pro version for a 2D game and found what seems to be a weird issue. When I have a pathfinder in a prefab, the scanning does not work:

but if I place the pathfinder in a scene and then add the prefab in question, scanning works fine:

Why would this be happening?

This asset was made long before Prefab mode was a thing.
I’m confident that there are quite a few features that are inaccessible in prefab mode.

You could always make use of the saving the navigation graph to a file and load it in through the prefab.

I am not super surprised there are some issues with this working with the new prefab system, I was just wondering is @aron_granberg was aware of the issues and if anything was going to be done to add support for storing astar graphs in prefabs so I have a better idea of how I am going to need to design my workflow in using them (I can build around that lack of support for astar graphs in prefab but don’t want to spend time doing that if support is going to be added soon).

Hi

Generally a prefab workflow is not supported for a couple of different reasons.

Firstly there is only supposed to be a single AstarPath component in the scene at any time. Typically what you would do with prefabs is to create them and then have multiple in the scene.

Secondly things like storing graphs in prefabs is not supported due to limitations of the Unity serialization system. It is technically possible, but the large amounts of data makes the Unity editor slow down to a crawl. It was possible a long time ago, but when Unity rewrote their Undo system it got a lot slower when you had to serialize a large amount of data. You can save/load graphs from files however, see: https://www.arongranberg.com/astar/docs/save-load-graphs.php

If there’s some useful workflow that you think should be implemented I’m open to suggestions though :slight_smile:

@aron_granberg Sorry for the delay, that makes sense.

My use of prefabs might be slightly different than normal but since nested prefabs are now supported, I am actually using prefabs to store my levels instead of scenes (I think this workflow might be easier for me in the long run but we will see…).