Problem with adding audio file.

I am currently working on a unity tutorial project Space Shooter and I have an issue when I include the sound file provided in the assets package. The sound file is named as ‘explosion_asteroid’ and according to tutorial video, it is added by simply dragging into the prefab called ‘explosion_asteriod’ but when I do this, it also appears in the hierarchy window and in the play mode, the sound plays at the start of game just once and doesn’t play when an asteroid explodes. Help me to fix this. I am exactly following the same steps as in video but it isn’t working like that.

By dragging the audio file ‘explosion_asteroid’ into the inspector window of the prefab ‘explosion_asteroid’, It appears in the hierarchy window but in tutorial video, it is not showing in the hierarchy window.

  • Drag and drop the audio clip into the prefab’s inspector.
  • And delete the audio clip from hierarchy window & "turn off the audio source of the prefab and enable it when the explosion happens via scripting ", otherwise it will auto play when the game starts (if you don’t want it to happen).
  • Also check your script again.

I used another way instead of drag and drop the audio source file into prefab. Because that way wasn’t working, so the way I used is that by selecting the ‘explosion_asteroid’ prefab, I clicked on the ‘Add Component’ button in the bottom of its inspector and then add audio source file ‘explosion_asteroid’ placed in the Audio folder in assets. By doing this, the audio clip isn’t appear in the hierarchy window. It works fine.