I’m having some trouble with my code right now. I’ve been stuck on this for the past few hours. The troubleshooting is fun and all but I just want to get to my next step. So here is the simplest form of code that I tested trying to get this to work.
using UnityEngine;
using System.Collections;
public class ClearDebris : MonoBehaviour {
void OnTriggerEnter () {
Debug.Log("Entered Collider!");
//Works up till now
if (Input.GetKeyDown(KeyCode.Escape))
{
Debug.Log("E was Pressed!");
}
}
}
Essentially I want to press the E key while in a box collider to trigger an event such as Debug.Log(“E was Pressed!”); but any way I try this it wont seem to cooperate. I have tried just GetKey instead of GetKeyDown and it still wont work. Is there a typo that I’m just oblivious to? Please Help!!!