Adding audio to an animation?

lubaszj

New member
Hello,

I am trying to understand how to add audio to an animation. More specifically, I am following the Third Person Controller tutorial on Youtube and I have given a pistol to the model. However, when I fire the pistol, it does not make a sound. I have tried adding an audio source and audio clip to the pistol via the inspection window. Nothing. Please help?
 
You don't need to an audio source/clip to the item object itself. For a ShootableWeapon, you can set what audio clips are played on use under "Use" -> "Animator Audio":

1606217828417.png

The AudioSource itself will exist on the visible first/third person object (you shouldn't need to add it yourself).
 
You don't need to an audio source/clip to the item object itself. For a ShootableWeapon, you can set what audio clips are played on use under "Use" -> "Animator Audio":

View attachment 4380

The AudioSource itself will exist on the visible first/third person object (you shouldn't need to add it yourself).
This has been very helpful info. Thank you. I'm just gonna be totally honest as it's probably already glaringly obvious.. I'm new to both Unity as well as the Opsive Third Person Controller asset. It's like I got a new tool and I just want to fire it up without reading the manual. I should probably start from the very beginning with Unity, but I probably won't until I absolutely have to. I'm trying to get a sneak preview of some basic TPS stuff to see if I'm even interested enough to put some in-depth effort into learning to work with Unity. Basically, I'm trying to create a simple TPS player character, give him some basic animations and a gun, and then give him an NPC opponent to play around with. Maybe get a glimpse of some shooting mechanics and damage variable type stuff.

Prior to your tipping me off about the ShootableWeapon script, I had been toying with the ThirdPersonShootableWeaponProperty script and the regular Audio Source component. After several hours of tinkering, I was unable to get any sound when I fired a weapon in game. So I tried a combo of both of those scripts and the Audio Source component and I just got more confused. In frustration, I ctrl Z'd everything back to the basic character creation, recreated the item (pistol), and without tapping any scripts or additional audio sources, the darn pistol fired with audio.. I dunno. That's been my day so far. I sure hope you'll be around for me to pick your brain once in a while as I'm fumbling around with this project. Thanks again.
 
Top