`
aigo
  • 浏览: 2535703 次
  • 性别: Icon_minigender_1
  • 来自: 宜昌
社区版块
存档分类
最新评论

[UE4]UMG widget Property Binding(属性绑定),事件触发蓝图函数和C++函数

UE4 
阅读更多

假如用UMG绘制了一个button类型的widget,然后我们想让这个button的状态变化与相关属性或者函数绑定,则参考官方的文档如下:

 

Property Binding(如何绑定蓝图属性和蓝图函数)

https://docs.unrealengine.com/latest/INT/Engine/UMG/UserGuide/PropertyBinding/index.html

How to call functions from UMG?

https://answers.unrealengine.com/questions/84765/how-to-call-functions-from-umg.html

Event Dispatchers

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html

 

 

 ==============================================

这个是Epic的引擎工程师的回答:属性绑定、C++函数绑定,蓝图函数绑定三者的性能高低

https://forums.unrealengine.com/showthread.php?84604-UMG-Slate-Binding-Property-or-Function-Performance-differences

Binding Performance Order (Fastest -> Slowest):

Property Binding >> C++ Function >> Blueprint Function

 

Property bindings are function calls, but they go through a specialized fast path that calls only native code and looks up the data using reflection, caches a buncha stuff...etc. They're like an order of magnitude faster than binding to a blueprint function.

 

All bindings are evaluated at least once per tick, some are evaluated a couple of times, e.g. Visibility.

 

All that said, it really doesn't matter, all the binding options are much slower than setting the value directly. So if you need performance, avoid binding all together, set the values directly on the widget.

 

 

==========================================

Delegates(代理)

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Delegates/index.html

 

C++中的数据通过代理广播到蓝图中

https://forums.unrealengine.com/showthread.php?30345-Tutorial-Creating-and-Using-Delegates-C-and-Accessing-them-in-Blueprints

 

C++代码中以ID来创建widget button并绑定事件函数

https://answers.unrealengine.com/questions/151986/accessing-umg-subobjects-from-c.html

 

C++代码中以现有蓝图模版来创建Widget组件并操作Widget的属性

https://answers.unrealengine.com/questions/130528/c-create-widget.html

https://answers.unrealengine.com/questions/177938/create-umg-button-from-c.html

 

在UserWidget类型的C++代码中创建函数并在Widget蓝图的事件中调用该函数

https://answers.unrealengine.com/questions/164676/adding-a-c-function-and-calling-it-in-a-widget-blu.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics