28 lines
497 B
C#
Raw Normal View History

2023-05-12 15:25:59 +02:00
using UnityEngine;
public class respawn : MonoBehaviour
{
private GameObject player;
[SerializeField] private Transform respawnPoint;
2023-05-12 15:25:59 +02:00
void Start()
{
player = GameObject.Find("Frank");
2023-05-12 15:25:59 +02:00
}
void Update()
{
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Player"))
{
player.transform.position = respawnPoint.position;
Debug.Log("Respawn: Move");
}
}
}