Odd Behavior When Checking Bool With Tick Event

Hello,

I’m pretty new to the Unreal Engine. I recently started learning Blueprints with the Third Person Template Project and am seeing a weird issue - when I set a boolean variable to true with a key press, and I get the value of the variable with an event tick, it seems to toggle between true and false with every frame.

Here are the relevant blueprint timelines I’m currently working with. The top image show’s where I’m actually trying to set the variable, where the second image shows what I was planning to do with the variable every tick, and also where I’m printing it’s value for debug. The idea was that if the player was performing a certain action (i.e. falling or wall running), and they went into “camera mode”, time would slow.

272858-togglecameramode.png

Below are the print messages I’ve been using to check what the “InCameraMode” variable is being set to. The first screen is before the ‘E’ key is pressed, which prints “False” as expected. The second screen, however, demonstrates that the variable seems to flip/flop between true and false with every tick after the ‘E’ key is pressed.

Any idea why the variable is toggling back and forth when the key is pressed? As I mentioned I’m pretty new to the engine, so there may be something obvious I missed, but this seems like something that should be pretty straight-forward to implement…

Thanks in advance for any help!

This is odd… I just replicated your setup and the Tick prints Trues or Falses as I expect from toggling the FlipFlop - by any chance you’re not setting your InCameraMode boolean elsewhere in your BP? (Right click the variable and “Find References” to search for any other Setters).

In addition to checking for other camera mode “setters” how are you setting “on wall”? If that variable flips each frame you would have the same result as if the camera is being flipped.

Using the “Find References” option shows I only have the two setters and one getter… I feel like one of the other blueprints I’ve built on this character is causing the issue, especially if you were able to replicate the setup without issue. But if these bools are only being referenced where they are in the screenshot, I’m not sure where to look.

272874-references.png

The “on wall” variable is getting set to true after a begin overlap event with a wall, and is only set if the character is also falling. The variable is then set back to false after the “end overlap” event fires. I followed the tutorial here essentially bit for bit, but I can provide a screenshot of the blueprint if it helps.

On a side note, I wired up the “On Wall” variable to the print statement I included in my original post, and it does looks that it’s getting read properly. It doesn’t flip between true and false like the “Camera Mode” variable does.

I found the issue, and somehow managed to fix it… At one point I had attempted to add a simple camera overlay, so I took the time to learn a bit about widgets and blueprints from this tutorial. It was something I had done a long time ago and had quite frankly forgotten how it worked… But after removing the widget blueprint from the project, and removing it’s creation from the character blueprint, the issue went away.

Weird thing is, undoing those changes (replacing the widget blueprint, adding references to character blueprint) resulted in the issue still being fixed, and the whole time dilation checks working as I hoped they would… Going to look a bit more into it so I don’t make the same mistake again, whatever it was.