AI's for MazeGame!

Hi!
Im making a game for my schoolcourse during this summer where Im going to make a Mazegame where the player is suppose to find their way out from the maze while finding tresures and two different monsters chasing you in the maze.
I have done the maze by just adding alot of walls with Prefabs and know im wondering if it will be hard to make AI’s(the monsters) chasing you?
Will the AI’s have huge problems navigating through the Maze without getting stuck?
This is my first project and Im finding Unity fun :slight_smile:
/ walldoge

Make a navmesh for the level, then have the navmesh agents on the AI set their destination to player transform position, and they will handle the pathfinding for you.

So first step would be look into how to use navmeshes in unity: Unity NavMesh - Unity Learn

1 Like

Thank you so much!

1 Like

Everything @MadeFromPolygons_1 said above is spot-on, but let me add this from my own experiences with navmeshes:

To bake a navmesh, your geometry has to be marked static, or at least “Navigation Static,” so be sure to select ALL of the GameObjects you want considered for pathing, and in the inspector upper right window hit the static checkbox.

This is why it’s useful sometimes to make a parent GameObject for the level and put all the stuff you want to make static (NOT THE PLAYER!) as children of that GameObject, because that way you can tick static only on that parent top level object and say “Update all children.”

2 Likes

Very good to point out, I forget that when starting out this can really catch you out and is not obvious at all! I still forget to mark things static even to this day and have to often do a second bake :slight_smile:

2 Likes