revival/game/Assets/Scripts/Checkpoint/SafeZone.cs

20 lines
486 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using Ktyl.Util;
public class SafeZone : MonoBehaviour
{
[SerializeField] private SerialVector3 _respawnPosition;
private void OnTriggerStay(Collider other)
{
// Check if other game object is Player.
if (other.gameObject.CompareTag("Player"))
{
_respawnPosition.Value = other.gameObject.transform.position;
}
}
}