'UE4 C++ Create Background task with using Async() function
I want to create a background task with using Async function: (Async | Unreal Engine Documentation) I read and follow the documentation but i’ve got an compile error. This is the code:
int32 TestFunc()
{
GEngine->AddOnScreenDebugMessage(0,5,FColor::Red,TEXT("This is an async task"));
return 123;
}
TUniqueFunction<int32()> Task = TestFunc;
// Called when the game starts or when spawned
void ATempActor::BeginPlay()
{
Super::BeginPlay();
auto Result = Async(EAsyncExecution::Thread,Task);
}
There is no intellisense error. And the compile error is :
Async.h(297): [C2280] ‘TUniqueFunction<int32 (void)>::TUniqueFunction(const TUniqueFunction<int32 (void)> &)’: attempting to reference a deleted function
How can i use Async() function corectly? Thx a lot in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
