SOLUTION:
Do not reference self if your event might run after actor is destroyed, especially if you’re spawning a duplicate actor, it creates a dependency that breaks the engine.
I’m using UE 5.2, have been for a while on the same project, and suddenly last night it started freezing about 80 - 90% of the time I compile a blueprint.
It is not a crash with a crash screen, the engine stops responding, hogs a bunch of ram, and freezes indefinitely.
The times when compiling works, it works instantly as my code isn’t that heavy.
When End task through the task manager and restart the engine, it may compile fine or may freeze again, requiring a different restart.
Update, It seems to crash when compiling specific blueprints, but I don’t know what they have in common, one is an enemy parent BP (With no children yet) and 2 are projectiles.
Are you using any variant of ConstructorHelpers::FClassFinder or ConstructorHelpers::FObjectFinder ?
If the you are using set paths to objects or classes that are wrong (could have a mistype), it may hang unreal on load. Haven’t tried it during normal recompiles but it can be a culprit of engine hangs.
I only work in Blueprint, so would that be the equivalent of “Get all actors of class”?
If so, I used to in an old version of those blueprints actually, in the construction script, but deleted them because i thought they were causing the hangs.
Edit: In fact, I deleted them because they would error horribly, add hundreds of empty items to the arrays, and just bug out uncontrollably, so I stopped using construction scripts like that altogether, you think there’s a remnant of that code somewhere in this BP?
I have no more construction scripts running, I move them all to begin play after the bugs.
I only have one for a spawner that sets a box extent and some gizmos, but it doesn’t crash the engine.
This was in the regular event graph, in a custom event, and not in the construction script.
The problem is when the “spawner” actor is destroyed, that reference is severed with no chance to recover.
Oh that’s interesting, what I ended up doing was - indeed - cache the class, but I passed it to a separate spawner BP via interface just to be extra safe.
This works well.
Edit: Since I learned something, you earned the “Solution” badge