Hi, I’m trying to make this game and one part is where is an enemy collides with this radius I have created, then I press space, then it will die (hopefully). It’s not working and I’m really sad. Please help.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KillRadius : MonoBehaviour
{
void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "Enemy")
{
Debug.Log("hi");
if (Input.GetKeyDown(KeyCode.Space))
{
Destroy(gameObject);
}
}
}
}