UE4学习笔记: Functions

函数声明
UE4中有两种函数, 一种是传统的C++函数, 一种是UFunction. UFunction通过加入一些描述符来支持一些特殊功能
UFUNCTION([specifier, specifier, ...], [meta(key=value, key=value, ...)])
ReturnType FunctionName([Parameter, Parameter, ...])
主要有几种应用:
  1. 在Blueprint中调用
  2. 做为delegate, 如与按键消息进行绑定
  3. 网络回调和数据同步
  4. 做为命令行的指令执行, 同UE3的exec关键字

函数说明符
  • Blueprint相关
    • BlueprintAuthorithOnly: 没有网格授权的话不会在blueprint中执行
    • BlueprintCallable: 可以在blueprint中执行
    • BlueprintCosmetic: 表现函数, 不会在服务器执行
    • BlueprintImplementableEvent: 可以在blueprint中重写
    • BlueprintNativeEvent: 设计为被blueprint重写, 但是仍然包含native的实现
    • BlueprintPure: 不会影响自身对象
  • Network相关
    • Client: 只在客户端执行
    • Server: 只在服务端执行
    • NetMulticast: 会在服务器和所有客户端执行
    • Reliable: 函数执行通过网络进行复制, 并且是可靠的
    • Unreliable: 函数在复制执行时可能失败
  • Editor相关
    • Category
  • 其它
    • CustomThunk: 提供自定义的execFoo, 而不是生成的
    • Exec: 可以在命令行中被执行
元数据说明符
  • BlueprintInternalUseOnly
  • BlueprintProtected: 只在blueprint中调用
  • DeprecatedFunction
  • DeprecationMessage
  • UnsafeDuringActorConstru
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值