结构体

创建和实现游戏性类结构体的参考。

Windows
MacOS
Linux

虚幻引擎4中的 结构体 是引擎的反射系统,但不属于 UObject 生态圈的一部分。因此,创建它们要比在同样的数据布局中创建 UObject 更快,且支持UProperties,但无法被垃圾回收系统处理,也不能提供UFunctions。注意,UStructs无法在类中使用。

要将一个结构体变成UStruct,需使用结构体定义上方的 USTRUCT 标签,并在定义的第一行中包含 GENERATED_BODY(),如下所示:

USTRUCT([Specifier, Specifier, ...])
struct FStructName
{
    GENERATED_BODY()
};
Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback