private GameObject targett;
void Start()
{
targett = GameObject.FindWithTag("Player");
}
void Update()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
Destroy(targett);
}
}
if (collision.gameObject.CompareTag("Player"))
{
Destroy(collision.gameObject);
}
if (GameObject.ReferenceEquals(collision.gameObject, targett))
{
Destroy(targett);
}