Changing layers affect triggers?

I accidentally left my enemy on the default layer but then the triggers stopped working. When I change it back to default the triggers start working again, anyway to fix this?

Collider2D frontHits = Physics2D.OverlapPointAll (frontCheck.position, 1);

foreach (Collider2D c in frontHits)


if (c.tag == “Enemy”) {
// … Flip the enemy and stop checking the other colliders.


walking = false;

// Once transition has begun, reset the bool

if (animatorGetNextAnimatorStateInfo(0).IsName (“swat”))

animator.SetBool (“swat”, false);



Get rid of the “comma 1” – OverlapPointAll(frontCheck.position)

OverlapPointAll normally checks against all colliders. If you give it a second input, that says to ignore some colliders, and only look for ones on those layers. But layers in code are tricky to use. Read about layerMasks first. For example, 1 means to only check layer ZERO (which happens to be defaultLayer.) 2 is layer 1, 4 is layer 2, 8 is layer 3. If you read, the proper input looks like`1<