|
I'm making a Geometry Wars/Asteroids kind of top down shooter. I'm using raycasts as my bullets and I have a script that shoots the raycasts at an interval, simulating an automatic laser (see below.) Is there some way I could make a "laser blast" sound play at the same time that the raycast is shooting? I want to add sound to the laser, but don't know how to do it. Can someone please help? P.S Here's the code I use for my laser
(comments are locked)
|
|
audio.PlayOneShot(yourCoolSoundEffect,volume); Where yourCoolSoundEffect is an audioClip (simply drag and drop a wav file in your project window to import it as an AudioClip), and volume is a float between 0.0 and 1.0. Read a bit on AudioClip and AudioSource in the docs to get a better grasp of what you're doing. Serve fresh. Enjoy! Thanks bro!
Apr 01 '12 at 01:30 AM
TeleportSanwich
And it says Unknown Identifier "youCoolSoundEffect"...
Oct 03 '12 at 03:58 AM
Arpian
yourCoolSoundEffect is the variable name used for the AudioClip. Read : http://docs.unity3d.com/Documentation/ScriptReference/AudioSource.PlayOneShot.html
Oct 03 '12 at 04:28 AM
alucardj
alucardj, always so patient... I'm surprised you're not takng the time to explain what a variable and a type is.
Oct 03 '12 at 05:48 AM
gregzo
Extraterrestrials (non-human) thank you for detailed answer.
Oct 03 '12 at 08:36 AM
Arpian
(comments are locked)
|
