Why no "UNregisterCallback" in Royale Runtime Demo

Hi,
I was trying to learn UI Toolkit with UI Toolkit Unity Royale Runtime Demo
I saw something like this: someButton.RegisterCallback(ev => DoSomething());
but I didn’t saw it unregister the callback somewhere
However to my understanding usually we should unregister our callbacks.
I was wondering if I misunderstand something?
It would be awesome if someone could help explain!

some codes from the demo project:

void OnEnable()
        {
            // Retrieving interesting elements to:
            // 1- set values
            // 2- assign behaviors
            // 3- animate!
            var rootVisualElement = GetComponent<UIDocument>().rootVisualElement;

            matchOverLabel = rootVisualElement.Q<Label>("match-over-label");

            winnerIsLabel = rootVisualElement.Q<Label>("winner-is-label");

            winnerTeamNameLabel = rootVisualElement.Q<Label>("winner-label");

            mainMenuButton = rootVisualElement.Q<Button>("main-menu-button");

            // Attaching callback to the button.
            mainMenuButton.RegisterCallback<ClickEvent>(ev => OnMainMenuButton());
        }

Hm and it gets worse…
Since the Register is in OnEnable(), deactivating and reactivating the compoment would register the callback again, aka OnMainMenuButton() would be called multiple times.

This doesn’t happen, because the hierarchy is reconstructed on OnEnable so the callback is registered to the newly created UI elements.

If you want you can unregister callbacks on OnDisable, for example. This example hasn’t been updated in a while and is not perfect for sure! But it’s not a huge deal if you don’t unregister in this situation, which is why it wasn’t done initially.

Got it. Thanks for clarification!