- Home /
Make Navmesh agent follow closest object with tag
I have an npc that follows the player, but what I want to have happen is when the closest enemy with the tag of "enemy" comes with in a certain distance (for example, 75 units) the npc will go toward the enemy, fight, and when the enemy is dead, either return to the player or if another enemy is in range, go after it. I want to use Vector3.Distance, but I don't know how with objects with the same tag.
Comment