Hello I have sound which is playing on collision with layer "ground" of my object. But my object is standing on layer "Ground" from the beggining so it is triggerig my sound. How can I prevent it?
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.collider.gameObject.layer == LayerMask.NameToLayer("Ball"))
{
m_particles.Play();
m_audioSource.PlayOneShot(PlankImpact);
}
if (collision.collider.gameObject.layer == LayerMask.NameToLayer("Ground"))
m_audioSource.PlayOneShot(PlankImpact);
}