看了看Ue4文档中的接口类,摸索着进行了下,
在编辑器,先从Unreal interface派生个接口类ReceiveHttpInterface
废话不多说,上代码
接口类文件
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “CoreMinimal.h”
#include “UObject/Interface.h”
#include “ReceiveHttpInterface.generated.h”
// This class does not need to be modified.
UINTERFACE(MinimalAPI, Blueprintable)
class UReceiveHttpInterface : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class AIRLINEDEMO_FUKE_API IReceiveHttpInterface
{
GENERATED_BODY()
public:
virtual void ReciveHttpDataPlaceActor(const TArray< MyData>& data)
{}
};
派生自该接口类
头文件
UCLASS()
class AIRLINEDEMO_FUKE_API APlacementActor : public AActor, public IReceiveHttpInterface
{
。。。。。。。。。。
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void ReciveHttpDataPlaceActor(const TArray< MyData>& data) ;
};
实现文件
void APlacementActor::ReciveHttpDataPlaceActor_Implementation(const TArray< MyData>& data)
{
//GenerateActorArray(data);
}
然后就Ok了在蓝图中,也能使用了。