Hello,
I am designing a game in such a way that when a player collides with a coin, it gets destroyed. And quite frankly, that is working. However, whenever my player is jumping, the coins are acting as RigidBody objects (even though I don’t have RigidBody attached to it), not letting the user pass through them, and not detecting collision at all.
Here are some more information:
- Player has a RigidBody
- Coin do not have a RigidBody
- Coin has IsTrigger checked
- Yes, everything is 2D
- I am using a Polygon2D collider for the Player and the coins) (I also tried it with a box collider. Doesn’t work)
- I have tried adding a RigidBody2D to my coins after doing some research. Doesn’t help.
Any ideas? I will be REALLY thankful!
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("Collider with" + collision.tag);
if (collision.tag == "Player")
{
SoundManager.Instance.playSound(SoundManager.Instance.coinHit);
DestroyObject(gameObject);
}
}