public bool BSpace = false;
public GameObject coll;
void Update()
{
if (Input.GetKey(KeyCode.Space))
{
BSpace = true;
}
else
{
BSpace = false;
}
if (BSpace == true && coll.gameObject.tag == "DestroyObject")
{
Destroy(coll.gameObject);
}
}
public bool Space = false;
void Update()
{
if (Input.GetKey(KeyCode.Space))
{
Space = true;
}
else
{
Space = false;
}
}
private void OnTriggerStay2D(Collider2D coll)
{
if (Space == true)
{
if (coll.gameObject.tag == "DestroyObject")
{
Destroy(gameObject);
}
}
}