Answer the question
In order to leave comments, you need to log in
Input.GetKeyDown(KeyCode.E) not working?
I'm learning to create games, but I can't make one of the mechanics. If I remove "&& Input.GetKeyDown(KeyCode.E)", then when colliding with a friend, the player's prefab is deleted, as soon as I add it, nothing happens.
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "Friend" && Input.GetKeyDown(KeyCode.E))
{
Destroy(gameObject);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question