Game starts lagging the longer I play the game

Hey guys, so I have a strangest issue at the moment.

When I run my game, it starts out fine, but as I play, the game starts slowing down tremendously every second. After a while it’s unplayable.

My game is still super early stages, still configuring character’s abilities like sprinting, etc. So I haven’t implemented anything too complex.

Does anyone perhaps know why this could be happening?

Thank you in advance
Kind regards

You keep creating new timer events with each sprint. That is what is causing the slowdown with each press. They are slowly stacking eating performance.

You need to create a handle to the timer and then clear it once you stop sprinting.

To create a timer handle drag out the Set Timer By event Return value and choose “promote to variable”, You can then use that newly created variable to clear the timer.

Even if I remove all the sprint logic, the game still slows down. Everything was still fine yesterday. I’m really hoping I don’t have to restart this project, as I’m quite far along in the level building part…

likely some sort of memory like, ie an array you forget to clear and keep adding to but without code we can only guess

So when I switch over to a third person game mode, the problem is gone. I removed all the custom blueprints that I added to the firstpersoncharacter_BP, yet the problem still remains. Nowhere else have I changed anything. Where else could the problem then be if not in the firstpersoncharacter_BP?

Soz, I’m still very new to Unreal…

I found the issue, it was in my firstpersoncharacter_BP.

The guy in the tutorial uses a thirdpersoncharacter, and I’m using firstperson. So, to create the HUD widget to show my stamina, I plugged it into ‘Add Movement Input’, as the node for his tutorial was a bit different…

And so you learn lol…

1 Like

One thing I’m worried about though, I set my ‘Game Mode’ to ‘BP_FirstPersonGameMode’. It seems to be working, but when I click on the game mode icon, it still shows the ‘World Override’ is in thirdpersongamemode. So I had to select it and edit the pawn class back to firstpersongame mode. Is this normal? I feel like I broke my project… :frowning:

The the World override to “none”. (Window=> World Settings)
It will cancel out the override and revert to the your project’s default game mode.

1 Like

Thank you!

ah yeah you would have had 10s of thousands of main huds there haha

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.