// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.E)) { if (interactedObject) { LockOnObject.Invoke(interactedObject); GroundController groundController = interactedObject.GetComponent <GroundController>(); if (groundController) { groundController.Interact(); } PumpController pumpController = interactedObject.GetComponent <PumpController>(); if (pumpController) { pumpController.Interact(); } } } if (Input.GetKeyDown(KeyCode.Escape)) { gameMenu.SetActive(!gameMenu.activeSelf); } }