Question by
XSabermanX · May 11, 2020 at 08:20 AM ·
animationaudiocollider2dgrounded
Audio Issues with Animation + Grounded
I think that the animation of my player is moving the box collider of the player, this is then causing the box collider to go in an out of colliding with the ground and then playing a landing sound over and over. Is there anyway I can fix this? I am quite new to creating on unity.
When i disable the animations on the player the sounds play just once correctly how they should do.
This is some code in the collision area:
void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Ground")) { isOnGround = true; playerAudio.PlayOneShot(landSound);
}
if (collision.gameObject.name == "DeathBox")
{
Death();
}
if(collision.gameObject.name == "SlimePlatform3" )
{
winParticle.Play();
playerAudio.PlayOneShot(winSound);
}
Comment