Skip to content

Instantly share code, notes, and snippets.

@niiicolai
Created July 18, 2020 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niiicolai/fea61a160f396d4d30a0cde587c3a616 to your computer and use it in GitHub Desktop.
Save niiicolai/fea61a160f396d4d30a0cde587c3a616 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Portal : MonoBehaviour
{
[SerializeField]
private string playerTag;
[SerializeField]
private Portal target;
[SerializeField]
private Transform spawnPoint;
public Transform SpawnPoint { get; }
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag(playerTag))
{
other.transform.position = target.spawnPoint.position;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment