How can I support multiple agent types on the same NavMesh

All of my scripts function as expected when the NavMeshAgent is set as “humanoid”.
In an act of hubris I have struck out on my own to incorporate furry woodland critters that emulate random movement, prey runs from the player, predators attack. That sort of business.

Again, all of my scripts function as expected when the NavMeshAgent is set a “humanoid”.

When Emenent StewMeat the cute, happy mountain goat has his agent status switched to “quadruped” the Error Police come flying in with sirens wailing.

After some noodling around on my own and thus far only about forty-eight hours digging into this I have turned up little to specify why a NavMesh Surface doesn’t seem to support multiple agent types at the same time.

To that notion; I call BullPucky!

I done seen me some folk ridin’ ‘bout on some horsies in video games before an’ I be darned if I don’t get me some too.

Any input?

If you’re using the Legacy NavMesh (the one we present directly here in the course), you can’t. It simply won’t work.

If you’re using the new Unity NavMesh Tools (which, after 2022.2 you don’t have a lot of choice in the matter), then you’re already attaching a NavMeshSurface to a GameObject in the scene and baking it.

The good news is that there is no limit to how many NavMeshSurfaces you may add to your scene, each with a different Agent type. In fact, you can add multiple Surfaces to the same GameObject!

To install the NavMesh Tools, if you’re not already using NavMeshSurface, go to the Package Manager and install AI Naviation.

1 Like

Thank you. I will follow your advice and research in that direction. May even turn up some other cool tools to add to the mental arsenal.

That has ever been the real gem to following another’s tutelage; discovery. I am like Curious George in a house of mirrors when I get to exploring other methods of problem solving.

TBH, if I was my boss looking at my productivity to R&D imbalance, my ass would be flying out of the front door.

Cheers.

As a rule of thumb, we tend to say “Don’t chase upgrades”… the idea being “don’t upgrade your project to a newer version of Unity unless there is a pressing reason to do so, because that upgrade may cause unintended consequences to your project and put you even further behind”.

One of the nice things about my job (here) is that to keep current, I’m always chasing the upgrades. It’s FUN. (It has also broken my projects from time to time in unintended ways, so there is that).

1 Like

Privacy & Terms