{
public GameObject objToTP;
public GameObject tpLoc;
void OnTriggerEnter(Collider other)
{
if ((other.gameObject.tag == "Player"))
{
objToTP.transform.position = tpLoc.transform.position;
Debug.Log ("Teleported");
}
}
void OnTriggerExit()
{
print ("Teleport.Success");
}
}
I am trying to teleport my FPS controller by adding this script to the teleport trigger. I also added an empty as the tpLoc and the FPS controller to the objToTP. It is giving me the “Teleported” and “Teleport.Success” in the console but the fps controller is not being teleported. I think that I should mention that I have the same code just with a UI and having to press E. That one works. I also have this one in a different scene.