Updating variable in UMG from GI / GM. Why? and How?

cnapsys
Tue, 28 Mar 2023 20:57:08 +0000
Blueprint

Soooo… I’ve done it again. Found a way to get myself stuck and not being able to figure it out

Short explanation. EndLevel (umg) get’s triggered from GM when the level is finished.
When loading the umg, I do a sequence in the EventConstruct.

1. I cast to GI and get the previous total points → set a local variable in the umg

2. I cast to the GM get the current level points # of targets left, # of targets destroyed, time the level was completed in (used as a bonus multiplier) → set local variables.

3. Calculate the total from the previous total points + new total points (including the bonus) → set local variable and update the grand total in the GI.

The problem is that the grand total gets updated twice. Somehow, at the end of the level, let’s say the previous total was 10,000 and the new total is 560, as soon as the umg loads the total shows 10,560 and after a milisecond it changes to 11,120 (adding the new level total twice).
WHY??? I think I might understand… (probably because I have a function bound to the text box that displays the grand total which refers to UMGGRANDTOTALPOINTS). Since I’m updating the grand total in GI I guess the new local variable gets updated as well.
HOW??? How do I make this work?

Thanks in advance for putting up with my ADHD. I just can’t come up with anything tbh.

Function bind:

5 posts - 3 participants