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.