Simple AI Obstacle Avoidance in Unity

Опубликовано: 14 Март 2026
на канале: Ketra Games
10,071
213

In this Unity tutorial, we'll explore how to add some simple obstacle resolution logic to enemies, so they don’t get stuck walking into each other.

We’ll also look at how the same logic can be used to have the enemies navigate around obstacles.

To do this we'll make use of Unity's Physics2D.CircleCast method to detect obstacles and then take action to avoid them

This is the twentieth video in our series showing how to make a full top down 2D shooter game in Unity.

The playlist for this series can be found here
►    • Unity 2D Top Down Shooter for Beginners  

The project files are available to our patrons here:
►   / 107228431  

Want to follow along? This project is a good starting point
►   / 104708841  

The full Top Down Shooter Project is available to our patrons here
►   / 75231350  

The final scripts can be found here
► https://dotnetfiddle.net/hSzQHd

Help support our work:
► Patreon:   / ketragames  

Follow us:
► Ketra Games: http://www.ketra-games.com
► Patreon:   / ketragames  
► Twitter:   / ketragames  
► Facebook:   / ketragames  

Introduction - 0:00
Demonstrating the Problem - 00:31
Explaining Unity's Physics2D.CircleCast - 01:54
Implementing the Basic Obstacle Avoidance - 02:42
Improving the Obstacle Avoidance - 09:14
Testing Wall Avoidance - 14:19
Testing the Obstacle Avoidance in the Game - 15:54
Preview of the Next Unity Tutorial - 16:34

#KetraGames #LearnUnity #UnityTutorials #UnityTips