Start the coroutine and call the play sound, then yield until the sound has completed playing, once that’s done, destroy your object.
void OnCollisionEnter2D(Collision2D collision2D)
{
if (collision2D.transform.name == "BlueWall")
{
StartCoroutine(DestroyWithSound());
}
}
private IEnumerator DestroyWithSound()
{
PlaySound(0);
// Note you'll need to determine "soundIsPlaying" depednig on where PlaySound is playing a
// sound from. You'll need to know the audio source to check if its playing or not.
while( soundIsPlaying )
{
yield return null;
}
Destroy(gameObject);
}