A Collider problem.

Hi I want to know why this isn’t working:

void OnTriggerEnter (Collider sphere){
if (sphere.gameObject.CompareTag(“WallDeath”)) {
return;
sphere.transform.position = new Vector3 (0.0f, -1.0f, 0.0f);
SpawnTiles.Death ();
}
}
No error appeared on the it still just doesn’t work. The tag is there and it said the exact same as that and the IsTrigger thing is on. (It did one time say that the object reference not set to the instance of a game object but it went away after I deleted it and then pasted them same thing I deleted back in.) If you want to know what Death void is here it is:

public void Death(){

	ExplosionSound.Play ();
	MainMenuExit.GetComponent<Image> ().enabled = true;
	MainMenuExit.image.enabled = true;
	MainMenuExit.interactable = true;
	sphere.transform.position = RespawnPo;
	speedcount -= 0;
	IsDead = true;
	sphere.SetActive (false);
	sphere.GetComponent<MeshRenderer> ().enabled = false;
	sphere.GetComponent<Transform> ().transform.position.Set (0, 0, 0);
	StartCoroutine (DeleteScoreText ());
	CameraFlip.transform.Rotate (0, 180, 0);
}

There are numbers of reasons for collider may not work.

  1. You may forget to attach rigidbody with the collider gameObject.
  2. Collider size may be small.
  3. OnTrigger is not checked.
  4. Function name writing problem.
    So please checkout all these.