My Spawner Spawns Forever until Unity Crashes

I have tried absolutely everything… eveeeeerything. I am still new to Unity and it’s inner workings but from what I can find on the big wide internet… there isn’t a reason my spawner is doing what it’s doing which is just spawning indefinitely until Unity crashes.

this is my script… please I’m desperate here.

You could try taking it out of the update function into a void CheckMail() function then just call it in OnEnable() and in SpawnMail()…

Have you checked that all the prefabs that you are using have the tag “mail”?

Why don’t you try to save the spawned elements into a list and then checking that list size?

To be sure about the counting of spawning I would create a “manager” for the spawned objects. This manager could be singleton and you could spawn them using it. Instantly registering them in a list and checking the size of that list instead of searching for them.