Skip to content

Instantly share code, notes, and snippets.

@314pies
Last active February 22, 2022 19:09
Show Gist options
  • Save 314pies/0a190cc7b3ac17de65f2209034fbbd57 to your computer and use it in GitHub Desktop.
Save 314pies/0a190cc7b3ac17de65f2209034fbbd57 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UpdatePlayerRespawnPoint : MonoBehaviour
{
public Vector3 RespawnPoint;
private void OnTriggerEnter(Collider other)
{
//if the enter object is the player
if (other.tag == "player") {
//Update respawn point
other.gameObject.GetComponent<playerRespawnScrpt>().respawnPoint = this.RespawnPoint;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment