Cannot play a audio source that is disabled error.

Hi!
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?

9418961--1319672--upload_2023-10-19_16-58-32.png

9418961--1319675--upload_2023-10-19_16-58-50.png

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.

9419096--1319759--upload_2023-10-19_18-11-23.png