Disable Movement Function Will Only Run Once

I have a setup here that is supposed to make use of the Disable Movement built-in function. This event is fired on Begin Play from another blueprint and it works that time. The issue is that the Disable Movement function will not work a second time when this event is called at any other point.

As far a debugging goes, the event itself fires just fine, as evident by the fact the the Lock Camera bool works. The event that re-enables movement (not pictured) does this same thing, but sets the movement mode to walking, and unlocks the camera. Once again, the bool there works, but as the Disable Movement function does not run twice, I cannot confirm whether or not the enable works a second time. I also tried hard coding this by replacing the Disable Movement with a Set Movement Mode and setting it to None. That resulted in the same issue.

Just to be clear, when you try to reenable movement, your Set Movement Mode allows your character to move again, correct?

Also, it might be helpful to step through breakpoints checking what the movement mode is set to at various points:

It might help clarify what state your ai is in at various points. One possibility is that once enable gets called once, it gets called over and over again, so subsequent calls to Disable Movement get overriden.

Yes.

Ok I tried this by printing out the current movement mode on Event Tick. The mode was set to walking (after the initial call to the Enable event (pictured in first comment)), and never returned to None, despite the Disable Event (pictured at top) firing successfully.

I also but a breakpoint on the Enable Event node and confirmed that it was not firing when it was not supposed to.

Printing on tick isn’t a good way to do it, since it will only show you the state when you’re at your tick function. If it changes, then changes back before your tick, you won’t see it.

Instead, set a breakpoint (press F9 with a node selected) in your Enable and Disable functions. Your program will stop there and you can see all the inputs of that node (including a print string node, or whatever else) . This is also very helpful because it will show you if your code is getting run more times than you expect (like if your enable movement mode gets called constantly).

If you really want to print it to the screen, make sure to print it after every time you change it. That way you’ll see if it changes twice in a single frame. (Assuming you can see the changes as they fly by at 30-90 frames per second)

Found the issue.
The Disable Movement function was functioning perfectly fine, as evidenced by a print string that went off right after it that displayed the current mode. The problem was actually where I had called the Disable Movement Event from the controller blueprint. I had it before a Teleport node that was actually setting the movement mode of the character back to walking due to the natural movement. Moving the Disable Movement Event call to after the teleport fixed the issue.

Running a print string on tick is just a way I like to do it. I later printed after the Disable node and that actually helped find the issue. Thanks!

Glad you got it fixed!