How to get associated actor from GUI event?

GUI Button handler gets Button( Control type ) as its parameter.

public UIControl Button_New;
Button_New.Get<Button>().ButtonClicked          += OnSelectNew;
private void OnSelectNew(Button button)
{
    Debug.Log("Clicked: " + button.Text);
}

Button_New ( UIControl ) is an Actor, but button ( Button ) is just a member of UIControl.
So Button_New can retrieve Actor information like Name, but button cannot access to Name.
Is there a way to backtrack Get() from Button class to associated actor to access Actor members?
Some kind of way of identification is needed to distinguish GUI controls, especially with localized texts.

If you want to be able to identify buttons, you can assign to the Tag field of the Control. It can be any object, even the UIControl if you need it.

Umfortunately, distinguishing ‘buttons’ by assigning informations was not the purpose.

I was finding the way to query ‘Actor’ assigned by system if it exists.
Storing every needed objects into some kind of external container and making handcraft ‘Getter’ is theoretically possible, but it is not beautiful and error prone because it is not interconnected to actual reference relations.

No, it doesn’t exist afaik, because the Controls can exist just fine without an actor, like the entire editor is built on them. The Tag feature will let you store a reference to any object though, so you can simply assign the UIControl actor like myControl.Tag = myControlActor;. And later you can read that back and have access to the control’s actor.

Yes, surely a boxed object can handle any object…
I was finding that if engine manages association with related controls when Actor instantiated, so it was not ‘necessarily’.
I can refer Actors explicitly with code in that case, so additional storing is duplicatation in my case.

Assigning a tag to a button and checking if a button has a certain tag before running code does nothing.

using System.Collections.Generic;
using FlaxEngine;
using FlaxEngine.GUI;

public class ButtonClick : Script
{
    public Actor MainMenu;
    [Tooltip("The menu buttons.")]
    public List<UIControl> Buttons;

    public override void OnStart()
    {
        if (Buttons == null || Buttons.Count == 0)
        {
            Debug.Log("No buttons");
            return;
        }

        foreach (var button in Buttons)
        {
            button.Get<Button>().ButtonClicked += OnButtonClicked;
        }
    }

    private void OnButtonClicked(Button button)
    {
        Debug.Log("Clicked: " + button.Text);
        if (button.Tag == "ExitMenu") //even though 1 button on the menu has this exact tag nothing happens The code is never executed
        {
            MainMenu.IsActive = false;
        }
    }
}

Any thoughts?

edit: if I use button.Text= [put the text of the button here I want to close the menu];
then it will run the code and disable the main menu. However, that won’t work if my button doesn’t have text but instead has an image.

edit again:

 if (button.Text="Disable")

Well… I can set an image for the button and still assign text to it but change the button text alpha to 0 so it is not visible. Then when I click on the button that has the text “Disable” the main menu will be set to inactive.

Tag in a Control is not the same as tag on an actor, which is why nothing happens.

The differences between tags are not the point at all, because I am not using both.