宏GENERATED_UCLASS_BODY()与GENERATED_BODY()的区别

在4.6版本以后,推荐使用GENERATED_BODY()而非GENERATED_UCLASS_BODY(),因为GENERATED_BODY()不会重置保护级别,并且支持更多新特性,如使用常规C++构造函数和默认类别。FPostConstructInitializeProperties已被FObjectInitializer取代,只在必要时使用。
摘要由CSDN通过智能技术生成

在4.6版本中release note有以下说明:

You now define and use “normal” C++ constructors for your classes. You can use parameterless -constructors too now!
You no longer need to supply a category for your properties to expose them to the editor or Blueprints. You’ll get a default category now.
FPostContructInitializeProperties is deprecated. It’s replaced by FObjectInitializer, and you only have to specify it when you actually need it
“GENERATED_BODY” no longer resets your protection level to “public”. It will preserve your settings.
Please use the new “GENERATED_BODY” specifier instead of “GENERATED_UCLASS_BODY”. It enables many of these new improvements!

翻译过来

  • 可以定义和使用“常规”的C++构造函数,可以使用无参构造函数。
  • 不再需要为属性提供类别以将其显示给编辑器或蓝图。现在有默认类别
  • FPostContructInitializeProperties已经弃用,由FObjectInitializer代替,只需要在实际需要时指定它即可
  • GENER
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值