Certain level lagging when looking in a certain direction

So, as you can see in the video above, after i have packaged the game, the game lags a LOT when looking in a certain direction, however this doesnt happen when playing in unreal engine, it even doesnt happen when playing in standalone mode. I have no idea what is causing this, there isnt even anything that could lag the game in that direction?? I am using unreal engine 5.4.4. I need help ASAP, and it would be greatly appreciated.

Does your CPU and GPU usage get affected as well?

And does that direction lag anywhere in the world or do you only encounter the issue while looking at that specific area?

image
Doesnt look like it, in fact the usage decreases a tiny bit when looking at that direction
I also tested and saw that it only lags on the best graphics setting preset. Other maps work fine with max graphics settings.

Well doesn’t matter if it decreases. That can still create instability and cause lag. Could you please elaborate, is a certain direction in the world laggy or while that specific area is visible to the player?

It lags when i am looking at that direction, when i look in other directions, the game doesnt lag at all.

So you can go to a completely different location in the world but when you look at, let’s say north, you lag? Or do you mean the direction where that laggy location is? Also, have you used Unreal Insights?

Just realized, it happens when i am looking at the building. When i am in front of the building and look where it was lagging, it doesnt lag. Its something about the building or the NPCs inside it

I see. Does the NPC’s react when they’re in sight? Or how do you handle their spawn or render?

They are pre placed in the level. I have different maps which all have buildings and inside them are lots of those exact npcs. Every map works fine except that certain map.

Maybe you can try using that Unreal Insights I mentioned to see the performance difference across various levels. You can also consider setting up a more optimized logic for the NPC’s. Even if there are less NPC’s in that said building compared to other levels, they might be doing more complicated things, or maybe they are getting in each other’s way and getting in a useless loop or something like that. It would make sense the CPU usage dropping when you get closer to them or look at their direction but lag is certainly unexpected in this case if they are doing what they’re supposed to do regardless of the player. If you find more clues, we can continue investigating but these are all I can suggest for now

I’ll see what i can do