OnTriggerStay2D(CollIder2D coll) does not detect a collision if a object is standing still inside of the trigger?
I'm having a problem where if my player is not moving inside a trigger, the OnTriggerStay2D
function doesn't detect a collision.
I've googled around for a while but I've only seen answers that uses Rigidbody collision detection, which I don't.
I just use a BoxCollider2D.
Any fixes for this? :)
Answer by phxvyper · Jun 26, 2016 at 04:22 PM
BoxColliders actually require a Rigidbody in order for events to be triggered, including Trigger colliders. This is because collisions and triggers are physics events, and physics is implemented via the use of Rigidbodies.
You can always use Character Controllers, but those give you less control over things like colliders.
$$anonymous$$y character has a rigidbody, he activated the event a few times while moving inside the trigger, however if he stands still after it has been triggered once, it does not continue to trigger any event.
Answer by Sinecos · Sep 03, 2016 at 07:43 AM
Choose "Never Sleep" from Sleeping Mode in Rigidbody2D, now it will continuously detect a collision.
Your answer
![](https://koobas.hobune.stream/wayback/20220612083715im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Collision between two 2D objects. 1 Answer
OnCollisionEnter2D issues in Unity 5.2 1 Answer
2D Collision 0 Answers
boxCollider2D don't move with a tile object 1 Answer
Compatible collision constraint methods 0 Answers