Hi im new to Unity and game development, and i wanna ask something about my 2D project
my player keep disappearing on respawn point after falling to death zone,
this is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CheckPoints : MonoBehaviour
{
public Transform checkpoint;
GameObject player;
// Start is called before the first frame update
void Start()
{
player = GameObject.FindWithTag("Player");
}
// Update is called once per frame
void OnTriggerEnter2D (Collider2D plyr)
{
if (plyr.gameObject.tag == "Player")
{
player.transform.position = checkpoint.position;
}
}
}
Thank you in advance