BP oddly only works when UE window out of focus (also, no loop but still looping?)

BP in question: https://blueprintue.com/blueprint/925h8w1t/

Newer to BP’s. 2 issues while making a basic random strafe movement for my NPC’s on BeginPlay:

  1. Why is this looping? StartStrafe keeps triggering. I Initially compiled it so EndStrafe ultimately calls StartStrafe (but got an infinite loop error so I removed it) …but it still loops after recompiling like this. Should be noted this uproject got corrupt yesterday and wouldn’t open; I had to verify engine and migrate.

  2. The NPC only correctly moves when UE window is out of focus (video below). When in focus, you can see the NPC move for 1 tick then stop. This happened way before issue 1 or the corruption.

i think you’ve confused yourself a bit. you’re starting a timer for startstrafe inside startstrafe. that’s basically a recursive loop (in time).

probably because your code is weird.
you are calling end strafe at the end of the start strafe.
when ue is focused that means it will stop the strafe in the same frame it started. so it look like it doesnt move.

when the windows is not focused, ue lowers the fps automatically, and so maybe those timers take a bit longer to trigger, and let the npc move.

it’s ok to use timers, but not like that. you should watch a tutorial on timers.

1 Like

Appreciate the info. realized I was using Set Timer by Event wrong! Also silly me, I realized AddMovementInput is EventTick-based which explained the twitching :sweat_smile:

New at BP’s, not sure if this is wrong but this got it working

18-08-2025 19.14  ls8D