Nav Mesh Agent problem

Once I kill the zombie I’m getting an error
“SetDestination” can only be called on an active agent that has been placed on a NavMesh.

Also how do I add bullet firing sound effect. Like once we fire the bullet it should the sound effect.

Hi Druveel,

When you call Destroy on the zombie, also try to call SetActive(false) on it.

Did this fix it?

Yes. Thank you it did. But can you please help me with 1 more problem

How do I add the sound effect? I added audio source in different weapons(since different sound for different weapons) but how do I play them exactly while firing.

I know I have to PlayOneShot() but how do I declare it and call it

Have you already looked the method up in the API? If not, do that, please, because there is an example of how you could use it.

And if you want to have the sound played when the player shoots, you call the method in the method method where you make the shooting happen.

Give it a try and let me know how it worked. :slight_smile:

This topic was automatically closed after 28 hours. New replies are no longer allowed.

Privacy & Terms