UE C++ Blueprint Interface / C++接口

UE C++ Blueprint Interface / C++接口

UINTERFACE(MinimalAPI, Blueprintable)
class U接口名称 : public UInterface
{
	GENERATED_BODY()
};
 
/**
 *
 */
class 模块名_API I接口名称
{
	GENERATED_BODY()
 
public:
 
	// 只能在C++中重写
	virtual 返回类型 接口函数名(参数);
 
	// 只能在蓝图中重写
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
		返回类型 接口函数名(参数);
 
	// C++ 蓝图都可以重写 WARN : C++调用时 Execute_接口名(目标, 参数)
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
		返回类型 接口函数名(参数);
 
	// C++ 蓝图都可以重写 这个是增加了默认实现接口 WARN : C++调用时 Execute_接口名(目标, 参数)
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
		返回类型 接口函数名(参数);
	virtual 返回类型 接口函数名_Implementation(参数); // 在接口中实现一个默认的 接口函数
};

2024年8月10日 – 补

UINTERFACE(BlueprintType, MinimalAPI, meta=(CannotImplementInterfaceInBlueprint))

若不想在蓝图重载 ( BlueprintNativeEvent , BlueprintImplementableEvent)  使用

meta=(CannotImplementInterfaceInBlueprint)

标记即可

–Enjoy it–

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容