Adding a Gun Shot Sound

I am having trouble adding a sound to the shot. I don’t know where to assign the audio source. I have tried several areas such as the shoot point but those return null when attempting to assign the audio source.

‘Shoot point’ sounds like a good place. How are you trying to add your source?

I tried to assign a private AudioSource rifleShot at first on to Shoot Action but that didn’t work. Then I tried on the Unit script on awake but I have some units starting inactive so that also didn’t work.

An AudioSource is not a sound, it’s a place where sound is played from. You can place audio sources on the objects during design time. Then you assign the sound (AudioClip) to the AudoiSource and when it is time to make the sound, you call Play() on the source

1 Like

Silly me. I was trying to doubly assign it.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms