Support Forum

How to Setup 2D pathfinding with Point Graph in UI Space

I want to setup 2d pathfinding with the point graph in UI space but I cannot figure out how to make the AI path properly. I added a bunch of nodes as images in the UI and set their parent to be the root. When I perform a scan it all looks okay. I removed rigidbody and character controller from the AI so that it will just use the transform position. However, it does not stay on the paths and I am unsure how to fix it. I am new to using these tools so I appreciate any help that can be provided.


Could you explain a bit more about what it does that you do not want?

It is just not following the path between the nodes and I am not sure if it is because it is in UI space or not. Here is what I have done.

I set my point graph root to the parent of all my nodes.
My nodes all have a rect transform and are scattered around the UI space.

My AI has seeker, simple smooth, AIPath 2D,3D, and AI Destination Setter.
I made AIPath to be 2D orientation, constrain inside graph, and no gravity.
My target is just an Image that move in UI space where my mouse is.

Anyways, the AI is not following the path between the nodes and I cannot figure out why. I only want it to follow paths that it shows me when I run a scan, the blue lines between all my nodes. I apologize if I did not explain this very well but hopefully this helps.

Note that the AIPath script will loosely follow the path based on the “pick next waypoint distance” field. If you want it to precisely follow the waypoints then you might want to use the AILerp script. See Movement scripts - A* Pathfinding Project

1 Like

Thank you for your response! I added AILerp and removed AIPath but now it does not move at all.

Oooh, I figured it out, I think it was because I was scanning before the UI corrected itself and the paths were broken. Sorry!