public class MyEventChannel : ScriptableObject
public UnityAction<string, string> UpdateUiLabelEvent;
public void RaiseUpdateUiLabelEvent(string newLabelText, string labelName) {
UpdateUiLabelEvent?.Invoke(newLabelText, labelName);
[RequireComponent(typeof(Button))]
public class ButtonClickHandler : MonoBehavior {
public MyEventChannel eventChannel;
_myButton = GetComponent<Button>();
_myButton.onClick.AddEventListener(ButtonClick);
private void ButtonClick() {
eventChannel.RaiseUpdateUiLabelEvent("My new Label Text", "My Label");
[RequireComponent(typeof(TMP_Text))]
public class UiLabelUpdater : MonoBehavior {
public MyEventChannel eventChannel;
private TMP_Text _tmpText;
_tmpText = GetComponent<TMP_Text>();
eventChannel.UpdateUiLabelEvent += UpdateText;
private void UpdateText(string myText, string myLabel) {
if(myLabel != labelName) return;