So, given this information. What is the point of giving the SWeakWidget to the viewport?
GEngine->GameViewport->
AddViewportWidgetContent(SNew(SWeakWidget).
PossiblyNullContent(MyUIWidget.ToSharedRef()));
Am I wrong to assume that the reason we don’t give the Viewport a SharedPtr is because we don’t want it to be a form of “life support” for the widget it’s being given a “handle” on?
In this example MyUIWidget is a SCompoundWidget, the “master” widget so to speak, of which all other widgets are children. I guess that by “making sure the widget’s life time is managed in a central place elsewhere”, that is in this example, “elsewhere” is the HUD, which has a SCompoundWidget SharedPtr named MyUIWidget.
By keeping the Viewport from being a source of “life support” we make sure the widgets are dead when the HUD is dead (for example if we changed/killed the HUD from memory but kept the same Viewport), correct?
I think I understand your explanation, I just find it helpful to have a concrete example or two to solidify my understanding. Once I understand a what you’re saying within the context of an idiom or two I’ll not need to bugger you for input every time, so please correct me if I’m wrong. If you need some background on the above code, it’s part of my Hello Slate tutorial here.
I try to support the community when I can, if you do humor me the “buck won’t stop here.” I’m planning to update the Hello Slate tutorial soon, I had a hardware failure recently and it’s caused a bit of a setback. Luckily I was publishing all my research on this site so it’s all pretty well documented =)