- Home /
This question was
closed Sep 30, 2017 at 06:17 PM by
$$anonymous$$ for the following reason:
Thank you @bolkay for the answer!
Question by
$$anonymous$$ · Sep 30, 2017 at 05:54 PM ·
c#collisiongameobjecttriggers
Specific GameObject Collision Issue
I have a game of bumper cars going on. I have a trigger set with the tag PickUp at an opening where the player must knock the enemy out. Currently, it only recognizes the collision when the Player hits it. I want it to work only when the enemy, titled SkeleBase (It is a skeleton), hits it. Here is my current collision-detecting code.
void OnTriggerEnter2D (Collider2D other)
{
if (other.gameObject.CompareTag ("PickUp"))
{
count = count + 1;
SetCountText ();
}
}
The count updates a UI element to show amount of kills. Also, I work in C#. All help is appreciated!
Comment