Add method via code in the delegate Button.onClick

Hello everybody.

I am creating a procedural way buttons, but I can not add methods in the delegate Button.OnClick … Unity does not return me error, simply the method (public, void, and without parameters) is not added …

public void SetupButton () {
  var button = transform.GetComponent<Button>();
  button.onClick.AddListener(ButtonClicked);
}

public void ButtonClicked () {
  _buildStructureGUI.SelectedPool = _structurePool;
}

Ok guys, forget…

Worked, but is not showing in the Editor …