Problem with UI buttons


#1

Hello everyone,
i’m trying to change the visible canvas in the scene, from the main canvas to the options canvas.
So, from canOptMain to canOptVideo everything works.
When I try to switch from canOptVideo to canOptAudio nothing works, except by pressing “A”. The button ButtonAudio doesn’t work in any way>
Help me please!

public class MainMenu : SyncScript
{
// Declared public member fields and properties will show in the game studio
UIComponent component ;

    Button buttonExit, buttonOptions, buttonAudio;
    Canvas canOptAudio, canOptMain, canOptVideo;
    public override void Start()
    {
        // Initialization of the script.
        component = Entity.Components.Get<UIComponent>();
        buttonExit = component.Page.RootElement.FindVisualChildOfType<Button>("ButtonExit");
        buttonOptions = component.Page.RootElement.FindVisualChildOfType<Button>("ButtonOptions");
        buttonAudio = component.Page.RootElement.FindVisualChildOfType<Button>("ButtonAudio");
        //buttonOptions = component.Page.RootElement.FindVisualChildOfType<Button>("ButtonOptions");
        canOptMain = component.Page.RootElement.FindVisualChildOfType<Canvas>("CanMain");
        canOptAudio = component.Page.RootElement.FindVisualChildOfType<Canvas>("CanOptAudio");
        canOptVideo = component.Page.RootElement.FindVisualChildOfType<Canvas>("CanOptVideo");
        canOptMain.Visibility = Visibility.Visible;
        canOptVideo.Visibility = Visibility.Hidden;
        canOptAudio.Visibility = Visibility.Hidden;
    }
    public override void Update()
    {
        PanelMain();PanelVideo();
    }
    void PanelMain() {
       
        if (canOptMain.Visibility == Visibility.Visible)
        {
            if (buttonExit.IsPressed)
            {
                ((GameBase)Game).Exit();
            }
            if (buttonOptions.IsPressed)
            {
                canOptMain.Visibility = Visibility.Collapsed;
                canOptVideo.Visibility = Visibility.Visible;
            }
        }
    }
      void PanelVideo()
    {
        if (buttonAudio.IsPressed || Input.IsKeyPressed(Keys.A))
        {
            canOptVideo.Visibility = Visibility.Collapsed;
            canOptAudio.Visibility = Visibility.Visible;
        }
        if (canOptVideo.Visibility == Visibility.Visible)
        {
            if (Input.IsKeyPressed(Keys.Escape))
            {
                var panelMain = component.Page.RootElement.FindVisualChildOfType<Canvas>("CanMain");
                panelMain.Visibility = Visibility.Visible;
                canOptVideo.Visibility = Visibility.Collapsed;
            }
        }
    }
}