I am building a 2d game and I run this code with a collider on both the other objects (on trigger: on to the other object) but nothing works)The other object is name Coin and also it has the tag Coin. I added kinematic rigid body to the coin and still no work :( (If I deleted it still the same). Also, my player has to colliders and the collision detected on both coin and player are discrete. Also, they are prefabs both
void OnTriggerEnter2d(Collider2D other) {
Debug.Log("detected");
if (other.gameObject.CompareTag("Coin")) {
other.gameObject.SetActive(false);
}
}