I am trying to create a pick up system in my game that will display a widget and play a sound when the player has 3 logs. But, to prevent this from repeating I put a branch that detects if a Boolean is set to true. If it is, then the branch will do nothing. If it’s false than the Boolean will be set to true and then play the widget and then the sound effect.
This works fine for the first dozen or so logs, until a glitch will appear that will bypass the branch entirely and the sound and widget will appear even after the branch has been run through previously. When I ran it through a debug and this glitch occurs all the strings will turn white which I feel might be a bug with the engine but I’m not sure. Any help would be appreciated.
What Blueprint is this check happening in, is it in a persistent actor in your level, or are you destroying it and spawning another at some point etc.? Also are you setting that bool anywhere else?
(Assuming this is called in the logs event graph) When is this section of code called? If we could see a larger piece of your coding that would help us understand the context of the situation. Also, do you mean the widget is printed after a log object has been obtained 3 times by the player or every 3 logs is obtained? I think that this segment of the code (the widget and sound) should be called in the player character’s event graph or wherever you set the inventory. That would be a place to start.