so i wrote a sript that when my Player touches my enemy. my Player respawn should know that my camera is following my player. But when I respawn, she moves behind my background
how to do?
My scipt
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Respawn : MonoBehaviour
{
[SerializeField] Transform spawnPoint;
void OnCollisionEnter2D(Collision2D col)
{
if (col.transform.CompareTag("Player"))
col.transform.position = spawnPoint.position;
}
}
//Thanks