Download

Is there a way to manually terminate UBlueprintAsyncActionBase?

I made a UBlueprintAsyncActionBase class that listens for changes based on given variables and continuously updates a UMG Widget, but I can’t find a way to manually destroy it when the Widget is destroyed. This would lead to zombie objects hanging around when the Widget is destroyed. Is there a way to manually terminate them?

I was thinking if there was a way to get a reference to the UBlueprintAsyncActionBase object, I could make a BlueprintCallable EndTask() function that I could call in Blueprint when the Widget is destroyed, but it looks like the magic behind UBlueprintAsyncActionBase hides the return variable of itself from the latent node that it creates.

All of the examples of UBlueprintAsyncActionBase in the engine source only do one thing and terminate themselves when they finish. Maybe it’s just wrong to try to use them for a continuous listener?

Found a solution thanks to @KaosSpectrum. Adding this class specifier exposed a reference to the object:


UCLASS(BlueprintType, meta=(ExposedAsyncProxy = AsyncTask))

Then I can just make an EndTask() function that will call


SetReadyToDestroy();
MarkPendingKill();