- Home /
Question by
Firax666 · Mar 08, 2021 at 02:18 PM ·
trigger2d-platformercollider2dontriggerstay
OnTriggerStay2D don't work after changing layer
Hi, so I created some script that do something when player press button he's inside trigger. At the beginning it was working but because this trigger collider was in Default Layer and that stopped my character from jumping. So I created another Layer and then I could jump but the script stopped detecting trigger collsiion. I checked Layer Matrix and my player layer and this new layer are checked.
I know i can do this Physics.CircleOverlap2D but I just wanna know what I did wrong. Here's code. (btw it's 2D platformer game).
void OnTriggerStay2D(Collider2D coll)
{
if (coll.gameObject.tag == "Player")
{
if (Input.GetButtonDown("Action"))
{
// do something
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Collider that restarts the game? 1 Answer
Trigger Collider Getting Left Behind Object 1 Answer
Moving many 2D triggers is slow. Why? 1 Answer