Just add an input boolean parameter in the UpdateText function inside WB_UI. Then, anytime you change the value of WeaponMode you just need to get the reference of WB_UI and call UpdateText with the new value.
Of course, you can do this through an event dispatcher if you want to.
This should work, as I’ve mentioned. Additionally, I’d like to offer you some advice (always from a constructive criticism perspective and with the best intentions):
-
Name all variables with meaningful names. Now that you’re working on that blueprint, you understand what REF or TextBlock_0 means, but in two months, you won’t.
-
Try to always follow Unreal’s naming standards for variables. Unreal typically uses PascalCase, meaning the first letter of each word should be capitalized. Avoid using ? in booleans; the correct way to describe them is by adding a lowercase “b” before the name (bWeaponMode).
-
Be cautious with loops when mapping out function flows. I refer back to the first point: today, you can easily follow the flow because you’re actively working on it, but in a month, you might forget where everything goes and end up spending more time tracing the flow than actually working. Use reroute nodes; they’re quite useful for visually cleaning up the blueprint.
-
Be very careful with those 0.1-second delays or random values that, at first glance, don’t seem to make sense. They weaken your code and make it much less efficient. It’s better to use Timers. Additionally, randomness in values can drive you crazy later on, especially if you need to incorporate multiple delays into the same blueprint.