This is a very general question, but I figured I’m better off learning how to solve the problems I run into, rather than focusing on the specific problems I’m having and needing more help next time I run into problems.
Basically, I’m new to Unity, and after doing a few tutorials, wanted to make a game with procedurally generated maps. Unity’s built in navmeshes don’t really work for procedurally generated maps (unless Unity 5 has a new feature I’m unaware of), so I decided to try using the A* project. I created a grid graph like the tutorial, added an AI Path to my enemies and wrote a script to set their target to the player, added some code to the level generation script to update the graph when it created a new room, and tried it out.
But, as you’d expect, I’m having some bugs, because that’s what happens when you try a new thing in coding without really knowing what you’re doing. First, every node was marked as unwalkable, but having the graph run a scan (even though the level’s terrain hadn’t been created yet) solved that. Then I had a problem where none of the enemies moved, even though paths were generated for them. Adding a character controller to every enemy sort of helped, but I have no idea why. Now some enemies follow the play as expected, but some have awkward, stuttery animations, some sort of drift on in random directions while facing the player, many have their Y position changing even though they’re supposed to have a fixed Y position and be affected by gravity, and so on.
So how can I figure out what the problem is? How could I check why enemies weren’t following the paths before I added the character controller, when AI Path is supposed to be able to use a rigid body or transform? How can I find out why enemies are sometimes floating up off the ground, or drifting in random directions despite facing their target?