Performance of Binding vs Updating Directly

I have a 20+ UserWidgets, and I want to change the opacity and visibility from C++, every frame (currently it’s done in pure BP, and it’s a performance bottleneck).

I figure I have three options, all using C++:

a) Pass pointers to the UserWidgets to C++, save those and directly call MyUserWidget->SetColorAndOpacity() in C++
b) Add and expose a FLinearColor property in my C++, tell my UserWidget to Bind to that.
c) Add and expose a FLinearColor-returning BlueprintPure function in my C++, tell my UserWidget to Bind to that.

I’ve seen that Binding and using functions in Blueprints can be Really Slow. What about binding to functions written in C++, or C++ properties?

Does anyone know the relative performance between these three?

I highly doubt that 20 blueprint function calls per frame is a real performance bottleneck.
Have you profiled to figure out why?
For example, it may be that the bottleneck is the blending cost of 20 user widgets on to the screen.
Or it may be something about user widgets and how they are rendered that causes excessive state flushed in the GPU pipeline?
If, instead of using a binding, you set the transparency to the hard-coded value 0.5 (50% transparency) for the widgets, will it run fast enough?
That’s a good experiment to run, because the C++ can’t run any faster than a fixed value :slight_smile: