To fire an event when a value has changed, you have to know the old value, and check to see if it has changed.
To simplify doing this over and over I have a macro that I use to track if a value has changed.
This macro saves the setup value. Then every time you call the check, it will fire wither Value Not Changed
or Value Changed
, if Value has changed, you can look at the Old Value
and New Value
parameters.
To use this, I recommend calling the Setup
on BeginPlay
, and call Check Change
on Tick
. Here is an example I have setup. With this setup, no matter who changes the score, the next tick will detect the change and fire off the Print String
. In my normal case, it would be calling an EventDispatcher with the value change parameters.
Here is what is seen in the console, when I update the score a couple times.