How do you use SAssignNew?

I’ve read a few articles but I’m still unclear, mostly because articles tend to lack context. This is what I have now:


TSharedPtr<SVerticalBox> ActivateLicense;
	TSharedPtr<SVerticalBox> DeactivateLicense;

slate cpp

SAssignNew(ActivateLicense, SVerticalBox)

and further down…

void FPluginModule::HideLicenseUI(){

That last part triggers a breakpoint, apparently the pointer isn’t valid. I saw one guy initializing his pointers but I have no idea where that would go or if it’s what I need to do.

Any ideas?

Where DeactivateLicense is assigned?

You should have something like this somewhere SAssignNew(DeactivateLicense , SVerticalBox)?

Or your object is not initialized, so IsValid will return false

if (DeactivateLicense.IsValid()

That’s sort of what I just arrived at this very moment too. I’m firing off my license check BEFORE I’ve returned the slate structure. Makes sense now. :slight_smile: