- Home /
Unity2D - OnTriggerEnter2D not working
This was working honestly, 10 minutes ago. Then I closed and reloaded it my triggers weren't triggering.
I wan't to have a trigger whenever the player walks over a 'portal'.
The portal is just a sprite with a capsule collider 2d with 'Is Trigger' checked.
The player has a rigidBody2D and colliders as well.
The portal script is attached to the portal.
Player Inspector Portal Inspector Portal Code
public class PortalScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D coll) {
Debug.Log ("collided with the portal");
}
}
Am I missing something completely obvious?
Answer by tanoshimi · Aug 27, 2017 at 07:58 AM
I see your portal is on the "Player Arrows" layer. Are you sure this layer is set to collide with the player layer in the collision matrix?
I went back and changed it then it worked. I'm going to sit in the dark for a while, aha, thank you!
Your answer
Follow this Question
Related Questions
No Collision in 2D Game 3 Answers
Collider lets object through 0 Answers
How to make a little wiggle room for the collision? 1 Answer