Description

When you create a latent function in C++ with the FLatentActionInfo first it will incorrectly set up the linkage for the latent info such that it gets linked to the incoming execution pin of the function node rather than the output execution pin. This means whenever the latent action completes it will call the original function again, re-adding it to the LatentActionManager in an infinite loop. 

Steps to Reproduce
  • Create or edit an actor in C++
  • Add the following header/functions to the class

 

#include "Kismet/KismetSystemLibrary.h"
UFUNCTION(BlueprintCallable, category = Test, meta = (Latent, LatentInfo = "LatentInfo"))
void Latent_NoArgs(FLatentActionInfo LatentInfo)
{
    UE_LOG(LogTemp, Warning, TEXT("Latent_NoArgs called"));
    UKismetSystemLibrary::Delay(this, 1.f, LatentInfo);
};

UFUNCTION(BlueprintCallable, category = Test, meta = (Latent, LatentInfo = "LatentInfo"))
void Latent_OtherArgsLast(FLatentActionInfo LatentInfo, int A)
{
    UE_LOG(LogTemp, Warning, TEXT("Latent_OtherArgsLast called"));
    UKismetSystemLibrary::Delay(this, 1.f, LatentInfo);
};

UFUNCTION(BlueprintCallable, category = Test, meta = (Latent, LatentInfo = "LatentInfo"))
void Latent_OtherArgsFirst (int A, FLatentActionInfo LatentInfo)
{
     UE_LOG(LogTemp, Warning, TEXT("Latent_OtherArgsFirst called"));
     UKismetSystemLibrary::Delay(this, 1.f, LatentInfo);
};
  • Create a blueprint derived from this class and in begin play call all 3 nodes in sequence with a print connected to their completed pin
  • Add the new blueprint actor to a scene and hit play
  • You should notice that only the print connected to `Latent_OtherArgsFirst`'s completed pin will fire where as the other two functions will just print their log warning every second

 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-159823 in the post.

1
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint Compiler
Affects Versions5.0.2
Target Fix5.1
Fix Commit22220726
Main Commit22232340
Release Commit22220726
CreatedJul 18, 2022
ResolvedSep 28, 2022
UpdatedOct 21, 2022
View Jira Issue