Unity 2D: Glitchy Collision/Triggers Problem
I am making a simple top down Platformer. But I am noticing a recurring trigger issue. I frequently use Colliders with the "Is Trigger" set to true, to determine when my player is in range or if my mouse is simply trying to click the object with the collider. Everything works perfectly as long as I keep my objects that have colliders away from other ones that do. My buttons, for example, simply require the user to click on them. However, when they are touching a path, for example, the collider completely disables. The intruding collider doesn't even have to completely occupy the space of the button, it just has to touch it to prevent the button from working.
void OnMouseOver ()
{
if ((BS_Script.Can_Press == true) && (Input.GetMouseButtonDown (0))) {
BS_Script.Button_Animation.Play("Button_Press_Animation");
BS_Script.Activated = true;
BS_Script.Target.enableEmission = false;
PM_Script.Can_Move = false;
Ignition.enableEmission = true;
BS_Script.Can_Press = false;
if (!Ignition.isPlaying)
{
Ignition.Play();
}
if (BS_Script.Button_Type == Button_Script.Button_Version.Goal)
{
GM_Script.Blockers_Remaining --;
}
}
}
Here is the chunk of script I use for the buttons. Any intruding colliders have no script on them, like my path objects (They are also triggers).
Your answer
Follow this Question
Related Questions
How to Deactivate a Trigger collider on a Specific GameObject 2 Answers
(C#) Bullet Damage , OnCollisionTrigger2D not working,(C#) Bullet Damage, Trigger not working. 2 Answers
How to check if Player collides with trigger? 2 Answers
Why isn't my integer changing when onTriggerEnter is called? 1 Answer
Calculate BoxCollider2D based on the actual player sprite 2 Answers