public void checkForInteractions() { if (Input.GetButtonDown("Interact")) { // if the player workbench is open then close it and do not // interact if (playerWorkbenchUI.activeSelf) { playerWorkbenchUI.SetActive(false); freeze = false; return; } // look for a block entitty in the range of the player Collider2D collider = Physics2D.OverlapCircle(transform.position, LookUpData.playerRange, whatIsBlockEntity); // if we hit something then open that else open the player workbench if (collider != null) { // get the entity script and tell it we interacted with it BlockEntity blockEntity = (BlockEntity)collider.gameObject.GetComponent(typeof(BlockEntity)); blockEntity.interacted(this); } else { playerWorkbenchUI.SetActive(true); freeze = true; } } }