OnTriggerEnter not working, i have tried everything

I have a cube that is a trigger. It has a script attached called “Teleporter” which should teleport the player to a position when the player enters the trigger. But it doesnt. The player has a rigidbody, and the cube has a box collider with “Is Trigger” checked. My script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Teleporter : MonoBehaviour
    public GameObject player;
    public void OnTriggerEnter(Collider other)
        player.transform.position = new Vector3(-27.73f, .2f, 22.17f);
        other.transform.rotation = Quaternion.Euler(other.transform.rotation.x, other.transform.rotation.y + 180f, other.transform.rotation.z);

I have tried a lot of things, but it just doesnt work. Test doesnt get printed, and the only thing that happens is that the camera turns 180 degrees. Does someone know why?
P.S my scene is 3D.

  1. Does the player also have a collider
  2. Does the player actually pass through the trigger
  3. Is the player and the cubes’ layers allowed to collide with each other? (go to Edit - Project Settings - Physics and check all the boxes in the layer collision matrix for your player and cube layers, also enable ‘Queries Hit Triggers’)


Make Sure player also have a collider
Apply Tag On Player (“player”) and check condition in OnTriggerEnter
//do something