Delegate in UnrealEngine ——虚幻四中的委托

@ CloudGuan
@ Copyright 2016 Cloud Guan, Inc. All Rights Reserved.

Delegates System In Unreal Engine

What is delegates in Unreal Engine?And How use it?

Delegates allow you to call member functions on C++ objects in a generic, yet type-safe way. Using delegates, you can dynamically bind to a member function of an arbitrary object, then call functions on the object, even if the caller does not know the object’s type.
代理机制允许你可以类型安全的使用C++类的成员函数,还可以自动的绑定成员函数到任意的变量上,然后通过这个变量来调用,我们这个变量甚至不需要知道它的类型。
It is perfectly safe to copy delegate objects. Delegates can be passed around by value but this is generally not recommended since they do have to allocate memory on the heap. You should always pass delegates by reference when possible.
拷贝代理变量是完全安全的,代理可以使用值传递,但是因为他们会在堆上分配内存的原因,所以不建议这样做。最好是通过引用传递的方式来传递这个值
Both single-cast and multi-cast delegates are supported, as well as “dynamic” delegates which can be safely serialized to disk.
代理支持单播和广播,自动的代理会更加的安全在序列化到磁盘的时候

Type of Delegate

这是可以用于普通类型和函数的代理,没有特别要求使用UCALSS标记宏标记的类,基本声明方式如下表所示:

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值