- Home /
Firework Sounds
I have a particle for fireworks (Unity's Standard Assets). And I want to add sounds when a firework is spawned and blows up. How do I do that?
EDIT: I can't figure out how to detect firework explosions. That's my problem. I have everything, Sounds, AudioManager. But I can't figure out how to detect when the particle is born and dies
Answer by Code1345 · Jul 29, 2018 at 09:11 PM
You could create a gameobject with an audio source, and then put in an audioclip with the explosion noise in it. Then, once your firework is set to explode, play the audiosource. That is a fairly easy way of doing it. Let me know if you would like me to go further in depth with my explanation for this method.
I can't figure out how to detect firework explosions. That's my problem. I have everything, Sounds, Audio$$anonymous$$anager. But I can't figure out how to detect when the particle is born and dies
Okay, I see what you mean. There are two ways to go about this. The way I would do it would be to use an Invoke method on a delay. Let's say you have your fireworks exploding after two seconds from when you hit play. You could invoke a method after two seconds that holds the explosion noise. Or, you could use an if statement. You could check if the firework is null/destroyed in your scene, and if it is, play the explosion noise. I would probably use the Invoke, as to me it is a bit smoother and will be timed a bit better- but both work fine.
Your answer
Follow this Question
Related Questions
disabling shadow casting with SSE 0 Answers
Shuriken values in shader code? 0 Answers
particle collision with objects not working. 0 Answers
Blood "Explosion" Effect 2 Answers
Make raycast ignore some objects. 2 Answers