Sound only playing sometimes

I’ve done everything in the video but for some reason my audio will only play occasionally, unsure what to do. edit, I’ve noticed the sound effects play if i manage to trigger it twice, like banging the head on the ground a second time before it resets. also added more screenshots


From what I see in your first screenshot, the delay is 1 second meaning the scene gets reloaded within approximately 1 second. Since the game window is just a laggy preview, 1 second is usually problematic because that’s rarely enough time for Unity play a sound.

For testing purposes, increase the value in the Inspector. Set it to, for example, 5. Then test your game. If the sound plays as expected, you know that your code works and that the problem was the 1.

Once you verified that the problem is indeed not in the code, you could decrease the 5 slightly, and test your game to figure out if the audio source still gets played without any problems.

Did this help?

See also:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms