How to Teleport in Unity | Unity Tutorial

Опубликовано: 04 Октябрь 2024
на канале: Omogonix
16,590
336

In this Unity tutorial, I show you guys how to teleport in Unity using C#.

#Unity #Unity3D #GameDevelopment

For more Unity tutorials or more videos in-general - be sure to like, comment, and subscribe for more! 👍

Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class teleport : MonoBehaviour
{
public Transform player, destination;
public GameObject playerg;

void OnTriggerEnter(Collider other){
if(other.CompareTag("Player")){
playerg.SetActive(false);
player.position = destination.position;
playerg.SetActive(true);
}
}
}

Follow me on Twitter:
  / omogonix  

Try out my games:
https://omogonixlachlan.itch.io

Forgehub:
https://www.forgehub.com/members/omog...

Subscribe to my Second Channel:
   / @lachlanshelton129  

Join my Discord:
  / discord  

Facebook Page:
  / omogonix  

Follow me on Instagram:
  / uwugonixhalo