Hello,
I started a 2D procedural levelgenerator project and I am generating rooms. These rooms are connected in a separate step, but to make sure the exit of each room is reachable, I want to each room to have its own AIPath script. Each room generates a GridGraph at runtime and a prefab for the entrance is placed (with AIPath, Seeker and AIDestinationSetter), while the exit becomes the target of the entrance.
The pathfinding works already, however now I am stuck.
When a path fails (path.error==true), I want to generate the specific room the path belongs to again and then check the path.
So far I subscribed to AstarPath.OnPathPostSearch and this step works, however I do not have a way to identify which Seeker the path belongs to or which GridGraph the path belongs to. Can you guys please help me?
Those are the rooms I am generating, I can generate all rooms or a specific one again if the pathfinding fails. Each Entrance/Exit is the sibling of its corresponding room, so by getting the Seeker I could jump to the corresponding Room and generate it again.
The GridGraphs are generated at runtime, placed at the position of the corresponding room and named after the room. I could search for the room, that has the same name to get the room. That is if I get the GridGraph that belongs to the path.
Those are the ideas I have so far, but I’m stuck nonetheless.
Thank you in advance, if you need more information I will gladly provide it.