void Update() { if (Input.GetButtonDown("Fire1")) { InteractableItem hit = RayCastFromCamera(); if (hit != null) { hit.OnClickEnter(GetMouseUIPosition()); currentClickedItem = hit; } } else if (Input.GetButtonUp("Fire1")) { if (currentClickedItem != null) { currentClickedItem.OnClickExit(GetMouseUIPosition()); currentClickedItem = null; } } else if (currentClickedItem != null) { currentClickedItem.OnClickStay(GetMouseUIPosition()); } }