- Home /
Playing a Level-Up Sound
So I'm making an RPG-style game, and I set up a level-up system. It seems to work well. I have a void called 'levelEffect', and anything inside of it happens when the player levels. Here it is:
void levelEffect()
{
player.maxHealth = player.maxHealth + 100;
player.damage = player.damage + 30;
player.health = player.maxHealth;
}
I'm new to coding and need some help. So, can anyone tell me how to play a sound? Thanks in advance.
Answer by Jeff-Kesselman · Nov 24, 2014 at 04:44 PM
Add an AudioSource component to the object.
Then use this method: http://docs.unity3d.com/ScriptReference/AudioSource.Play.html
No, strangely enough that doesn't work. It just plays the clip upon startup regardless of conditions.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Play Audio Through Scenes 0 Answers
How to make sounds louder if I go faster 1 Answer
How to use Hashtables? 0 Answers