Check out example codes for "unity 2d teleport script". It will help you in understanding the concepts better.

Code Example 1

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Teleportation : MonoBehaviour {

	public GameObject Portal;
	public GameObject Player;


	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void OnTriggerEnter2D(Collider2D other)
	{
		if (other.gameObject.tag == "Player") 
		{
			StartCoroutine (Teleport ());
		}
	}


	IEnumerator Teleport()
	{
		yield return new WaitForSeconds (0.5f);
		Player.transform.position = new Vector2 (Portal.transform.position.x, Portal.transform.position.y);
	}
}

Learn ReactJs, React Native from akashmittal.com