How can I debug this crash? Max number of UObjects exceeded (UE 5.1.1)

Screenshot 2023-03-27 105648

Hey guys,

I’m on UE 5.1.1 and I’m encountering a crash that I need help with. Please see the above screenshot for the details. Seems to be related to the maximum number of UObjects being exceeded.

The project uses blueprints, and everything is compiled and I’ve refreshed the nodes on every blueprint class.

This crash happens in the editor, as well as in the packaged game, but when it happens in the editor, I don’t get the crash popup, and it just hangs forever.

The only thing I can see in the crash log that would be the cause is this:

“[2023.03.27-02.01.51:669][891]LogSpawn: Warning: SpawnActor failed because of collision at the spawn location [X=760.000 Y=2011.541 Z=5.683] for [BP_Grunt_C]”

That is repeated hundreds of times before the crash happens.

I am just learning UE, so I’m wondering if there’s a way to debug this? Something that shows me the UObjects being created during runtime or something like that?

I thought about trying to change the number of UObjects in project settings, but I wouldn’t even know what to set it to, and whether or not it would fix the problem, or just delay the crash. Assuming there is something that is constantly creating objects, I think it would only delay the crash…

Anyway, please help if you can!

Hi @PeacefulJim

Ok well to debug this you have 2 choices depending on the actual issue.

Does your level have or need that many uassets in the level? Now im guessing you dont have that many. So that brings me to 2nd option. You need to locate where you are spawning so many actors as thats what your log seems to be implying that its attempting to continuosly spawn an actor, that its blocked by collision. And on doing this maybe its taking too long to release the actors or they staying in memory. Not easy to tell.

So, that grunt blueprint sems to be the culprit. Right click on the asset and choose find all references (or words to that effect im not at my desk sorry)

Now hopefully theres not too many, but you are looking for a spawnactor node.

Find it (or them) and for now disconnect them and see if the problem is still there. If its gone, good, half way there, find out why its not spawning, wrong location? Try setting it to always spawn disregard collisions. If that works then its possibly trying to spawn in an area it cant so fix that.

Also check u havent done something silly like spawning actors ontick , they will get collision errors and possibly that could be the problem.

Its difficult to tell for sure but you do have a clue with the error log so start there. Sounds like some crazy looping spawn happening sp fast that the garbage collection isnt cleaning up quicker than your calling spawnactor code

Thanks for your help @High500 !

The problem was this loop.

I changed it to this, and the problem is solved!

1 Like

Hah sometimes the error log is obvious , sometiems not, surprised it didnt trigger an infinite loop . So easy to get lost in code and create something thats a big no no
Glad u got sorted