OnTriggerEnter2D not working

Hello,
OnTriggerEnter2D isn’t working.
This is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class interactCheck : MonoBehaviour {

public bool interactCheckOn = false;

void Start () {
	this.gameObject.SetActive(false);
}

void Update () {
	if (Input.GetKeyDown(KeyCode.E) && interactCheckOn) 
		{
			Debug.Log("Hey, you can't put an if statement inside of an if statement in C#!");
		}
}

void OnTriggerEnter2D(Collider2D other) //please just work
{
	if (other.gameObject.CompareTag("tutSign1")) 
	{
		this.gameObject.SetActive(true);
		interactCheckOn = true;
		Debug.Log("Woah, I made a script in C# that DID something!");
	}
}

}

The GameObject that I’m trying to collide with has the tag ‘tutSign1’, and both of the GameObjects have a BoxCollider2D and a Rigidbody2D. Both of the BoxCollider2Ds have ‘Is Trigger’ on.

The GameObject with that script is a child of the player and is following it, and the BoxCollider2D is in the same place as the player.

Thanks :slight_smile:

Try setting the GameObject which this script is NOT attached ‘isTrigger’ to false.

I figured out the problem, it didn’t want to work because the GameObject wasn’t active (and the Rigidbody2D was doing some weird things)