So I’m building a game for a school project. It’s a top-down asteroids-style shooter where waves of enemies spawn into the game world. They currently have a simple AI routine that has them approach the player and then start firing their weapons. The player can also fight back.
Everything compiles fine in blueprint and the game works without a hitch, but every single time about 30 seconds into it, the game will suddenly crash. And the error log that pops up is pretty much the same each and every time.
I’m not tech-savvy enough to decipher the log and understand what it means. Does anyone here know what’s going on? Thanks.
(There is one possible cause, and it might stem from the fact that this game used to be a 4.8 project. I changed the version number and continued working on it with 4.9. Could this be the cause?)
!velocity.Contains.NaN() seems to be the error - means a velocity became “Not a Number”
any places in your project you may divide by zero around 20-30 seconds in relating to character movement?
perhaps a steadily decreasing number finally hits 0?
Ok, so my game has a feature where the player ship can level up. Every time it does a bunch of variables including movement speed go up. Then I have a custom event that updates the player’s character movement component’s max walk speed to match it.
I disconnected that custom event and the crash has disappeared. So does this mean that UE4 doesn’t like it when a character’s max walk speed is being dynamically updated?
Ok I think I fixed it. The issue is that the event that updates my character’s movement speed is being called every tick, which I made it that way with the assumption that I want the movement speed to be dynamically changing. That must’ve been what’s causing havoc. At some tick along the way there is no value currently set and that must be what’s being put into the character movement component’s max walk speed, hence crashing the game.
I changed the event that updates the max walk speed into a function and then made it called only every time the player levels up. When I did that, the crashes went away. I’ll figure out some way to make it dynamically alterable, but for now my problem’s been fixed. Thank you very much MrGrr for pointing out the lead I had to follow!