Unwillingly used the ball to make the sounds

…and it works quite well.

Haven’t reach the point where I have to change the clip between “boing” and “crack” though.


    void OnCollisionEnter2D(Collision2D collision)
    {
        if (!hasStarted) return;
        Brick brickScript = collision.otherCollider.gameObject.GetComponent<Brick>();
        if (brickScript && brickScript.IsBreakable)
            // Play Crack
            GetComponent<AudioSource>().Play();
        else
            // Play Boing
            GetComponent<AudioSource>().Play();

    }

Privacy & Terms