2D Toolkit Forum
2D Toolkit => Support => Topic started by: pablopun ch on December 16, 2013, 08:39:35 am
-
So I am having this crazy issue. I am collecting coins in a platformer. The coins have a box collider that has isTrigger enabled/checked. This coin is an Animated Sprite that has a tag of coin. My player has a child gameObject that has a rididbody and capsule collider. In my player script I have the following:
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("coin")){
Debug.Log ("Hit");
}
}
What could I be doing wrong. This seems pretty straight forward. I just want to detect the collision in the console and move from there. I have also tried the following:
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "coin"){
Debug.Log ("Hit");
}
}
-
Does it ever call OnTriggerEnter? If it is, then you could print out other.gameObject.tag to see what its printing?
-
No it is never called. I have now tried checking the Is Kinematic on my rigidbody for the player. Still no luck
-
Just a guess: Do you use 2d colliders? Then it's OnTriggerEnter2D...