Unity: Creating Simple Wander AI Behaviour

Following up on our previous post about how to create a navmesh to simulate basic crowd behaviour, here’s a pretty easy way to script some random movement to give you a basic “Wander AI” behaviour for your game objects that you can use for for your 2D or 3D projects. This is a quick, no frills tutorial that shows you how to start with a simple 3D game object and attach some very basic AI to it with the end result being a game object wandering around your scene. This is ideal for NPCs, non interactive characters, or zombies for your zombie game (because you know, zombies). The choice is yours and the possibilities are endless!

Wander AI made easy


As an example, you can follow the previously mentioned navmesh crowd Behaviour tutorial and instead of using a waypoint for your agent destinations, you can also follow TRGameDev‘s WanderAI tutorial and attach the wander script to the agent game object. So now, instead of having a group of agents all moving towards a defined destination/way point, they will simply wander around aimlessly, which is exactly what we want in this scenario. This is a very simple solution that you can use to build upon in your game. Once you have this foundation you can use it to create and control more complex actions with your characters and scenes.

2 thoughts on “Unity: Creating Simple Wander AI Behaviour

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.