Activate an input to pickup or search objectes

Hey,

I’m currently working on a script to pickup things or search a box, which may could contain some items. I set up the script with a trigger methode. Now, my problem is, that if I hit the assigned key, I get no response. After reading the documentation, I know, that “Input” should or must be called in the update methode.

Now I don’t know how to combine these to methodes. I hope you could help me.

Here is the code I have written so far:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ContentResponse : MonoBehaviour {

	public Text display;
	public bool key = false;

	void OnTriggerEnter(Collider other)
	{
		if (other.tag == "Player")
		{
			display.text = "Drücke E um die Kiste zu durchsuchen.";

//"press E to search the box"

		}
		if (Input.GetKeyDown(KeyCode.E))
		{
			Debug.Log("Gefunden"); //"found"
			key = true;
		}
		Input.ResetInputAxes();
	}
	void OnTriggerExit(Collider other)
	{
		display.text = "";
	}

	// Use this for initialization
	void Start () 
	{
		display.text = "";

	}  
	
	// Update is called once per frame
	void Update () 
	{


	}
...

use OnTriggerStay instead of OnTriggerEnter as enter is only called once and stay is called when you are inside it