Download

How to properly set a Blueprint callback to C++ code

In this case I’m trying to set a FStreamableDelegate from Blueprints that it not possible to do directly because I it’s a static delegate.
The code comes from a BlueprintFunctionLibrary class



UFUNCTION(BlueprintCallable, Category = "Resources Loading")
static void LoadAssetAsync(TAssetPtr<UObject> asset, FStreamableDelegate& delegateToCall, TAsyncLoadPriority Priority);




void UResourcesLoader::LoadAssetAsync(TAssetPtr<UObject> asset, FStreamableDelegate& delegateToCall, TAsyncLoadPriority Priority)
{
    if (asset.IsPending())
    {
        const FStringAssetReference& aRef = asset.ToStringReference();
        UAssetManager::GetStreamableManager().RequestAsyncLoad( aRef, delegateToCall, Priority);
    }

}

What’s the best way to do it?
Should I use LatentInfo like *UGameplayStatics::LoadStreamLevel() *?