I am trying to destroy an object in the editor with the Space keycode but it isn’t working. This is the code I wrote.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class destroy : MonoBehaviour
{
public GameObject Other;
// Update is called once per frame
void Update()
{
if(Input.GetKey(KeyCode.Space))
{
Destroy(Other);
}
}
}
Are there any issues. Please can someone tell me