itch.io is community of indie game creators and players

Devlogs

Don't forget to set the volume of your AudioSource!

aBoxCollecThingys
A browser aBoxCollecThingys made in HTML5

So, i was struggling a lot with this project cause the SOUND WOULD NOT PLAY in the build, but everything was fine in the Unity editor.

I tried everything, got very confused, posted a long chaotic devlog in here... and after taking a break from this problem... 

well, i found the solution and fixed it in a matter of seconds.


What was the real problem here?

// example unity's c# code statement before the fix

audioSource.PlayOneShot(theAudioClip);

 in my scripts, i had everything right, but i forgot to set the volume for 2 (out of the 3) moments where the Audio Source would play.

// example unity's c# code statement AFTER the fix

audioSource.PlayOneShot(theAudioClip, 0.7f);

All i had to do to fix it was... set the volume. Just adding two simple '0.7f''s in there would have avoided me and the game being messed up with for a few days.

Leave a comment