Sound effects are emitted before objects collide with each other. How can I fix it to make a sound when colliding?
private void OnCollisionEnter2D(Collision2D collision)
{
{
if (collision.gameObject.tag == “ground”)
{
SfxCtrl. SoundPlay();
Destroy(gameObject);
}
}
{
if (collision.gameObject.tag == “rtan”)
{
SfxCtrl. SoundPlay();
gameManager.I.addScore(score);
Destroy(gameObject);
}
}
}