Cannot play a audio source that is disabled error.

I want to play a death sound when the player dies. For some reason this sound effect does not play due to the audio source being disabled. Every other sound effect works fine. Im lost, any tips?



Debug it. Experiment.

There are a couple odd things you have going here, so check which one it might be by temporarily removing each one.

  • you use Destroy(gameObject, DeathClip.length)

Does the behavior change if you don't destroy the object, or you wait a little longer (DeathClip.length+0.1f)?

  • right after starting a timer to destroy things, you set the Time.timeScale = 0

Does the behavior change if you don't freeze game time?

  • you use Destroy() followed by Invoke() with the same timer value

thanks, that fixed another part of my problem. But not the initial problem. The new scene loads after the duration of the
audioclip but it still does not play.