- Home /
Unity crashes when it tries to play a sound!
Hello, everyone
I have a problem that i don't know exactly why it is happening!
I have assigned my script to the player and then i did add audio source to the player
The problem is that, when Unity tries to play the sound it suddenly crashes!
The idea is that i want to check if the sound is playing or not, and if it is not playing then, it starts playing by fading in
Here is my code:
void Update()
{
FadeInSound();
}
void FadeInSound()
{
float i;
if(Input.GetKey("up"))
{
if(audio.isPlaying == false)
{
for(i = 10; i > 0; i++)
{
audio.volume = i * 0.1F;
}
}
}
}
Please help me
Thank you all for your time, any help is greatly appreciated.
Comment
Best Answer
Answer by tanoshimi · Aug 19, 2014 at 06:21 PM
for(i = 10; i > 0; i++)
That there be an infinite loop....
Your answer
Follow this Question
Related Questions
Fading Audio in/out with object creation 1 Answer
Smooth GUI and Audio Volume Fades 5 Answers
Audio Fade With Toggle 0 Answers
Help with Audio Fade 2 Answers