RMB Up for GUI

I am trying to make a UI that only appears while the player holds the RMB. There are buttons on this UI which only become active during this time. I want the player to be able to hold down RMB, have the menu appear, move their cursor over their choice of button, and upon release of the RMB, their selection is made and the UI elements become unactive until they hold RMB again. I cannot seem to find a way to detect that release of RMB to select UI elements, though I can make it so that while holding RMB the player can click with LMB… Any help would be greatly appreciated. TIA!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;

public class DecisionMenu : MonoBehaviour
{
#region
[SerializeField]
bool timeSlowed = false;
float slowedTime = 0.2f;
float normalTime = 1f;
#endregion

[SerializeField]
GameObject menuPanel;

void Update()
{
    if (Input.GetMouseButton(1))
    {
        timeSlowed = true;
        menuPanel.SetActive(true);
    }
    else if (Input.GetMouseButtonUp(1))
    {
        //I would like to select the UI element right here, with release of the RMB.

        timeSlowed = false;
        menuPanel.SetActive(false);
    }

    if (timeSlowed)
    {
        Time.timeScale = slowedTime;
    }
    else if (!timeSlowed)
    {
        Time.timeScale = normalTime;
    }
}

}

If you properly manage an enum that detects inputs, mainly used on your Main.cs(or master class), you can have the setup you wish to achieve. This would simply require that “RMB held = true” which would look like :

if (Main.rMB == true)
{
    if (!newWindow.enabled)
    { newWindow.enabled = true; }
    else
    { // allow selection of tabs }
}
else { // select tab }

or something along those lines…