OnTriggerEnter not working. (167884)

My on trigger enters are not working yet my box colliders are tagged and is set to is trigger. Does there seems to be a problem with my code? I am trying to reset the players position.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class resetscript : MonoBehaviour {
int score;
public Text count;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void OnTriggerEnter (Collider other) {
	
	if (other.gameObject.CompareTag ("reset")) {
		transform.position = new Vector3 (46, -5, 26);
	}              
}

}

Have you attached Rigidbody to one of the colliders?

1 Answer

1

Possible issues:

  • The player’s collider also has “isTrigger” turned on - triggers don’t collide with other triggers.
  • The player does not have a Rigidbody component.
  • The box colliders do not have the correct tag (which is case-sensitive)