Hey guys, I’m having trouble trying to get my audio to play every time my player collides with a block. Its about a 50/50 chance, which I found is weird.
I tried all the solutions that I looked for online, but have yet to find one to help me.
What I tried:
Lowering my fixed time stamp
Changing my player and block collision detection to continuous
My Script for the collision:
public AudioSource collisionSound;
void OnTriggerEnter2D(Collider2D col)
Color myColor = GetComponent<Renderer>().material.color;
Color otherColor = col.gameObject.GetComponent<Renderer>().material.color;
if (myColor.Equals(otherColor))
{
collisionSound.Play();
effect.Play();
}
Thanks!