Answer the question
In order to leave comments, you need to log in
Why do events float on contact with a trigger in Unity 2d?
Hours 6 already stuck on the spot.
void OnTriggerEnter2D(Collider2D other)
{
string a = other.gameObject.tag;
switch (a)
{
case "Right":
Debug.Log("Right answer");
break;
case "NotRight":
Debug.Log("Not right answer");
break;
}
}
Answer the question
In order to leave comments, you need to log in
it all sounds like you have not one single object touching the trigger, but a whole bunch.
make a mini scene. where ONLY ONE trigger and ONLY ONE object that touches it and NO extra scripts and logic.
make sure that all this works, and then see what was wrong with you in the scene (maybe turn off the object, maybe create objects somewhere or something else that makes the trigger react)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question