How can I detect when the name of a gameobject has been changed in the editor and do something when that happens?

I think this has something to do with the editor classes, but I’m not sure.

I have an object A with a child B. B has a UIText.
What I want is that whenever I change A’s gameobject name then B’s text change to the same.

Si I think I have to detect when the change occurs and then capture that event and change the name of the text.

Thanks in advance.

Nevermind,

I think I found a solution: I created a script with the ExecuteInEditMode descriptor.

[ExecuteInEditMode]
public class ChangeTextAccordingtToName : MonoBehaviour {

    private string oldName;
    public UnityEngine.UI.Text textToChange;
	// Update is called once per frame
	void Update ()
    {
        if (name != oldName)
        {
            if (textToChange != null)
            {
                textToChange.text = name;
            }    
        }
        oldName = name;
	}
}

Still a good question, still not a good answer — a pragmatic one, though.