using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using Cinemachine; using UnityEditorInternal; using UnityEngine; using UnityEngine.Rendering; [RequireComponent(typeof(BoxCollider))] public class Teleporter : MonoBehaviour { [SerializeField] private Transform _out; private void OnEnable() { GetComponent().isTrigger = true; } private void OnTriggerEnter(Collider col) { if (!col.gameObject.TryGetComponent(out CharacterController cc)) return; var go = col.gameObject; var outPos = _out.position; cc.enabled = false; go.transform.position = outPos; cc.enabled = true; } }