OnTriggerEnter is only called once, when the collision happens.
You could try OnTriggerStay which is called almost all the frames for every Collidercoll that is touching the trigger
Input.GetKeyDown is supposed to be used in Update. You might be able get away with using it in OnTriggerStay if your FixedUpdate rate is the same as your Update rate but that’s unlikely.
So maybe use Input.GetKey(KeyCode.E) in OnTriggerStay.
Keep in mind that if the object that entered the trigger is a rigidbody then it may fall asleep if not moving and stop triggering OnTriggerStay.
It’s not just unlikely, it’s pretty much impossible.
Input should only be handled in Update or LateUpdate. It should never be handled in physics callbacks like FixedUpdate, OnCollisionXXX, OnTriggerXXX as these will always have the problem of missing inputs.
Yeah in theory it could seem impossible but in practice it can work as I recently helped somebody else with a similar problem. After doing a little test I found that it did actually work when the Fixed Timestep was changed so that the FixedUpdate rate matched the Update rate. Although I still wouldn’t recommend doing it.
This isn’t possible because the Update rate is never fixed. Theoretically a maximum update rate can be set but never a minimum. There’s no way to guarantee a framerate in Unity.
It might have worked temporarily for you for a short time under ideal conditions. It won’t work in the real world on varying hardware etc.