我一直试图在我的头文件(使用ue5 c++)中声明这个函数,并让编译器告诉我这个错误:
未识别类型'TFuture‘-类型必须是UCLASS、USTRUCT、UENUM或全局委托。UnrealHeaderTool ParserError*
static TFuture<UTexture2D*> ImportImageFromDiskAsync(UObject* Outer, const FString& ImagePath, TFunction<void()> CompletionCallback);我在这里做错什么了?
最小可重现性示例:
#include "CoreMinimal.h"
#include "PixelFormat.h"
#include "UObject/NoExportTypes.h"
#include "Async/Future.h"
#include "TSImageLoader.generated.h"
// Forward Declare Texture 2D
class UTexture2D;
DECLARE_LOG_CATEGORY_EXTERN(LogTextureSerializeImageLoading, Log, All);
UCLASS(BlueprintType)
class TEXTURESERIALIZEIO_API UTSImageLoader : public UObject
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (HidePin = "Outer", DefaultToSelf = "Outer"))
static TFuture<UTexture2D*> ImportImageFromDiskAsync(UObject* Outer, const FString& ImagePath, TFunction<void()> CompletionCallback);
};发布于 2022-06-16 07:13:42
好吧我想明白了。
TFuture不能返回将公开给蓝图的函数。因此,删除上面的UFUNCTION()标记就解决了这个问题。
https://stackoverflow.com/questions/72640483
复制相似问题