Which is more performant? Check then set or just set all?

Which is performant? Regardless of whether they are in C++ or blueprint.

A) Check all 100 variables then set the one that requires changes.


B) Set all 100 variables regardless of the variables that they are holding?

It depends; check + set are 2 instructions, two cost more than one…
But, if the check ends early than it will be less than 100 instructions so it’s going to be much faster than writing 100 variables.

Thanks. Looks like i might to rethink about how to store those required changes into an array and translate that to specific change function. Doing UMG (main menu) now, sorting out state change is a real pain. Looks like i have to make do with set all variables for sub menu items for now.