title: Unity OnControllerColliderHit detecting not detecting correctly
body: <p>I am trying to teleport the character when they touch a cube, but for some reason, it prints the message that it the collision is being detected, but the character's position is not changing. It works for another scenario that is almost exactly the same, but even if I put this in another script, it does not teleport the character. Here is my code:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class othercollision : MonoBehaviour
  {
      // Start is called before the first frame update
      void Start()
      {
  
      }
  
      // Update is called once per frame
      void Update()
      {
          
      }
      void OnControllerColliderHit(ControllerColliderHit hit)
      {
          if (hit.gameObject.name == &quot;teleportcube&quot;)
          {
              gameObject.transform.position = new Vector3(-3184.53f, 20.35f, -171.585f);
              Debug.Log(&quot;Collision detected&quot;);
          }
      }
  }
  </code></pre>
  <p>Here is the script that has something similar working:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using System.Threading;
  public class detectcollision : MonoBehaviour
  {
      public GameObject tplocation1;
      public GameObject player;
      public GameObject entranceloc;
      void OnControllerColliderHit(ControllerColliderHit hit)
      {
          //This if statement does Debug.Log the message and it also changes the player's position.
          if (hit.gameObject.name == &quot;trigger&quot;)
          {
              Debug.Log(&quot;triggered&quot;);
              gameObject.transform.position = tplocation1.transform.position;
              Thread.Sleep(7);
              Application.Quit();
          }
          //This if statement does not change the player's position, but Debug.Logs the teleporting message.
          if (hit.gameObject.name == &quot;entrance&quot;)
          {
              gameObject.transform.position = new Vector3(-3184.53f, 20.35f, -171.585f);
              Debug.Log(&quot;teleporting...&quot;);
          }
  
      }
  }
  </code></pre>