UE4_创建一个异步蓝图节点
Posted djw1993
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UE4_创建一个异步蓝图节点相关的知识,希望对你有一定的参考价值。
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintAsyncActionBase.h" #include "MyBlueprintAsyncActionBase.generated.h" /* * 这是申明的多播 也就是异步节点的输出引脚 */ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDoComplete, FString, Key); /** * 创建节点需要继承 UBlueprintAsyncActionBase */ UCLASS() class MYNULL_1_API UMyBlueprintAsyncActionBase : public UBlueprintAsyncActionBase { GENERATED_BODY() public: UMyBlueprintAsyncActionBase(); UPROPERTY(BlueprintAssignable) FDoComplete DoComplete; public: /* * BlueprintInternalUseOnly 只允许蓝图使用 蓝图调用的函数必须时静态的 不知道为什么 */ UFUNCTION(BlueprintCallable, Category = "MyThings", meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject")) static UMyBlueprintAsyncActionBase* DoThing(const FString Str); /*
// Fill out your copyright notice in the Description page of Project Settings. #include "MyBlueprintAsyncActionBase.h" UMyBlueprintAsyncActionBase::UMyBlueprintAsyncActionBase() { } UMyBlueprintAsyncActionBase* UMyBlueprintAsyncActionBase::DoThing(const FString Str) { UMyBlueprintAsyncActionBase* BlueprintNode = NewObject<UMyBlueprintAsyncActionBase>(); BlueprintNode->DoOther(Str,BlueprintNode); return BlueprintNode; } void UMyBlueprintAsyncActionBase::DoOther(const FString Str, UMyBlueprintAsyncActionBase* Async) { UE_LOG(LogTemp, Log, TEXT("AAA")); Async->DoComplete.Broadcast(Str); }
* 这是主要的函数 */ void DoOther(const FString Str, UMyBlueprintAsyncActionBase* Async); };
以上是关于UE4_创建一个异步蓝图节点的主要内容,如果未能解决你的问题,请参考以下文章