Help with path finding towards destination

I’m new to unity and i was wondering how does one create path finding ai so it can detect and move only if there is an unobstructed path for it to move to its destination? Like in this picture, the slime needs to detect if enough blocks have been broken so that there is enough space for the slime to move towards the paddle.

In this particular case, I don’t think you need full path-finding; you just need to find if there is a column of empty blocks. (Or maybe two neighboring columns of empty blocks?) Just write a loop that checks each column in turn.

In more general cases, you’ll need to write (or find) some path-finding code. There are lots of different variations on the basic search algorithm, but A* (pronounced “A-star”) is the one most people reach for most of the time. This looks like a decent introduction to the topic.

1 Like