Answers for "unity teleport script 3D"

2

unity 2d teleport script

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);
	}
}
Posted by: Guest on October-10-2020
0

unity teleport script 3D

THE SCRIPT UNDER MINE UNDER MINE IS A FAKE ONE AS YOU CAN SEE IN THE CODE IT SAYS COLLIDER 2D AND ONTRIGGERENTER2D DONT USE THE OTHER SCRIPT
Posted by: Guest on May-10-2021

Browse Popular Code Answers by Language