Severe performance issue when spawning enemies

Hi everyone, let me explain my problem. I’m making a game where you can “possess” your enemies and play as them, this means that they all share a parent class with all the functions for the player even when they are controlled by an AI.

I created an actor with the function to spawn these enemies. If I spawn them on beginplay there are no issues at all, but if i spawn them calling a custom event later in the game my fps start to go way down, without stopping, they just keep go down. And if i kill all the enemies the fps don’t suddently go back to normal, they just stay really low.

[Spawning Enemies on BeginPlay (no performance issue)][1]
[Spawning enemies with a volume in the level (severe performance issue)][2]
[This is the UE4StatFile][3]

My guess is that cast is failing (first image), and somehow code is in never ending loop. And each additional call just increases never-ending loops count and causes fps to drop.
Try to put breakpoints and see if it is executed as expected.

If it is executing as expected, then I think that problem is somewhere else.

CAN I MARRY YOU?

:smiley:
Glad to help :slight_smile: