using UnityEngine; public class Teleport2D : MonoBehaviour { public GameObject toPoint; void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { other.transform.position = toPoint.transform.position; } } }