Quantcast
Channel: Latest Questions by thecoolracer
Viewing all articles
Browse latest Browse all 33

AudioSource.PlayOneShot only works ONCE on Unity 5?

$
0
0
I am updating my Easy Footsteps script to work with Unity 5. Seems that it is really broken. I ran the updater thing and it presented no errors, but when I start walking around the footstep only plays once. That is it. I have put Debug.Logs over my script to see what is blocking it, the Debug.Logs are reached and there are no errors. I have also tried to AudioSource.Stop() before calling PlayOneShot but nothing changed. This is really annoying since the raycasts hit properly, everything works properly, I've debugged everything I can - it still only plays once. This is how the PlayOneShot() part looks like: if(FootstepHit.collider.tag == FootTag2) { if(Leg == 1) { GetComponent.().Stop(); GetComponent.().PlayOneShot(Leg2Footsteps[Loop3]); Debug.Log("Playing sound!"); } EDIT: Just noticed that when I walk a bit, click away from the editor, and then bring focus back to it - the footstep plays! But again, only once - at the moment when I give focus to the window. This has got to be a bug.

Viewing all articles
Browse latest Browse all 33

Trending Articles