I am trying to create a latent function for the custom blueprint class extending an actor. Within the actor I want to connect to a device – the connection code is handled by a separate thread. I want to have a function Connect which has two responses OnSuccess and OnFail. I figured out how to define this, but I am still little unclear how to utilize LatentActions. On my update function I can check the status on the connection thread and then return appropriately. I looked at this tutorial: http://www.casualdistractiongames.com/single-post/2016/05/15/Creating-Latent-Functions-for-Blueprints-in-C but I am still missing details to progress on this. Any help would be appreciated.
// in header I defined enum
UENUM(BlueprintType)
enum class OUT_EXEC : uint8
{
OnSuccess,
OnFail
};
// then declared function
FUNCTION(BlueprintCallable, Category="Connection", meta=(ExpandEnumAsExecs = "exec", Latent, LatentInfo="LatentInfo"))
void Connect(OUT_EXEC& exec, struct FLatentActionInfo LatentInfo);
Thanks!