Hello! I’m new to Unity and C# in general. I followed a tutorial on how to make a pathfinding system, and it actually worked pretty well, but what I really wanted to do is to make the blue cube follow the red cube.
How exactly can I make the blue cube move along the traced path? Thanks in advance!
The tutorial I followed: A* Pathfinding (E01: algorithm explanation) - YouTube
For this kind of thing, I have always used the Navigation Mesh. It might seem a tad daunting at first glance but it’s actually very easy, especially for following. Here is a tutorial series on implementing it: Navigation Mesh Basics | Unity AI Pathfinding (Part 1) | Table Flip Games - YouTube
The basic area is you create a navigation mesh, which defines the area that can be walked (or unwalkable). Then you have a Nav Mesh Agent component that can set its path to the location of your red cube (or whatever). Then it will navigate around the walkable area to your set destination!
You can go further with this approach and add more diversified pathfinding, obstacles and whatnot. The video link should be enough to get you started though, goodluck.