SuperAPI AI 工具集

ue-blueprint-cpp-interop

编程与开发

查看项目

更新于 10-16 04:56

技能介绍

该技能聚焦原生代码与 Blueprint 虚拟机之间的边界,目标引擎为 UE 5.8,相关 API 以 5.8 头文件为准。依赖模块为 Core、CoreUObject、Engine,使用 Project Settings 页面还需 DeveloperSettings。所有说明符的权威来源是 Runtime/CoreUObject/Public/UObject/ObjectMacros.h,未在其枚举中声明的不算说明符。

涵盖范围:用 UFUNCTION 暴露可调用或可重写函数(如 BlueprintCallable、BlueprintPure、BlueprintImplementableEvent、BlueprintNativeEvent、BlueprintAuthorityOnly、BlueprintCosmetic、CallInEditor、Exec 等),以及 UPROPERTY 的数据暴露、getter/setter、参数与引脚映射规则。函数库部分说明 UBlueprintFunctionLibrary 的静态方法、WorldContext 与 DefaultToSelf 的用法;还涉及 Latent 节点、异步动作节点、蓝图可实现的接口、UENUM/USTRUCT、委托与事件,以及从 C++ 回调蓝图图。

必要用法:触发蓝图实现事件时应使用普通名称(如 OnDied()),不要调用 OnDied_Implementation();子类重写用 virtual void OnDied_Implementation() override,并以 Super::OnDied_Implementation() 链式调用。Latent 节点必须带 meta=(Latent, LatentInfo=..., WorldContext=...) 与 FLatentActionInfo 参数,并用 FindExistingAction 做 UUID 保护,否则重复进入会叠加动作、引脚多次触发。异步动作节点用 UBlueprintAsyncActionBase,工厂方法需 meta=(BlueprintInternalUseOnly="true"),完成后 SetReadyToDestroy();未注册的动作只会存活创建时那一帧。

限制:float 与 double 在蓝图中都显示为 Real 引脚,建议标量用 double 以免插入收窄转换;私有成员上使用 BlueprintReadWrite/ReadOnly 会报 UHT 错误,除非加 meta=(AllowPrivateAccess="true")。ExpandEnumAsExecs 只接受一个输入参数。关于各 meta 键与更多完整实现,资料指向 references/blueprint-meta-specifiers.md 与 references/blueprint-node-patterns.md。