Unknown member '<name of overlay>' in 'canvas' (3506)

Greetings, I get the error from the title even though I got the UI?

I am pretty new so I got no idea what I have done wrong. This code below gets executed whenever a button I selected gets clicked.

The code should get the UI, check the visibility of the overlay and collapse/make it visible depending on its current status. Please help!

    PrimaryShopButtonUI(Wdata:widget_message):void=
        Print("Opening PrimaryShopUI 2")
        if(Player:=Wdata.Player, PlayerUI:=GetPlayerUI[Player], SelectedButton:=Wdata.Source):
            if(Widgets:=MaybeMyUIPerPlayer[Player]?):
                if(Widgets.PrimaryOverlay.GetVisibility(widget_visibility.Collapsed)):
                    Widgets.UnselectedOverlay.SetVisibility(widget_visibility.Collapsed)
                    Widgets.PrimaryOverlay.GetVisibility(widget_visibility.Visible)
                else:
                    Widgets.UnselectedOverlay.SetVisibility(widget_visibility.Visible)
                    Widgets.PrimaryOverlay.GetVisibility(widget_visibility.Collapsed)

Unknown member suggests to me that it isn’t being seen for some reason.

I wonder if this video might help any:

1 Like

Hello! This might work but right now I am stuck at GetVisibility as I have no idea how to use it and I cannot find anything online… Can you please help me with an example for this one? Thank you!