繼承于UBlueprintAsyncActionBase的類,異步輸出節(jié)點(diǎn)的實(shí)現(xiàn)方法,代碼測試正常
.h文章來源:http://www.zghlxwxcb.cn/news/detail-618092.html
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include "MyTwoParam.generated.h"
/**
*
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FResponsDeleget,int32,ID,FString,Data);
UCLASS()
class SPLINEPOINT_API UMyTwoParam : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintAssignable)
FResponsDeleget Onsuccess;
UPROPERTY(BlueprintAssignable)
FResponsDeleget OnFail;
UPROPERTY()
int temp = 0;
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"))
static UMyTwoParam* MyClassAsyncActionBase(const int32 ID);
virtual void Activate() override;
};
.cpp文章來源地址http://www.zghlxwxcb.cn/news/detail-618092.html
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyTwoParam.h"
UMyTwoParam* UMyTwoParam::MyClassAsyncActionBase(const int32 ID)
{
UMyTwoParam* NewFeroxNode = NewObject<UMyTwoParam>();
NewFeroxNode->temp = ID;
return NewFeroxNode;
}
void UMyTwoParam::Activate()
{
//Super::Activate();
if (temp>0)
{
Onsuccess.Broadcast(temp,"success! from c++");
}
else
{
OnFail.Broadcast(-228,"Fail");
}
SetReadyToDestroy();
}
到了這里,關(guān)于UE5自定義藍(lán)圖節(jié)點(diǎn)(二)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!