Is it possible to set visibility on a Canvas slot?

I’m trying to figure out how to toggle the visibility a given slot on a Canvas through code.

My goal is to stack a number of overlapping Images on the Canvas and only have one visible at a time. Basically I’m trying to implement custom mouse cursor appearances inside a single blueprint.

Right now I am casting to a UCanvasPanelSlot, which is fine if I want to reposition the element, but I can’t seem to find relevant functions to disabled or hide it, even though I see there is a “Visible” dropdown available in the blueprint under Behavior that does the job.


mySlot0 = Cast<UCanvasPanelSlot>(ImageMouse->Slot);
mySlot1 = Cast<UCanvasPanelSlot>(ImageGrab->Slot);

Any suggestions will be appreciated! Thanks

EDIT : Seems I have a work-around… I can call SetSize to 0. Wonky but I guess it works.

I would highly recommend storing a slot to widget map seeings as slots don’t provide any way to get the widget they contain (unless I’m wrong)

Yeah I just thought it would be efficient if you could overlap 4 or 5 different images on a single mouse widget and set all but one as Hidden. I’m quite new to Unreal so I don’t know “best practices” for anything.