Cannot Enter Playmode (Unity hangs for 20mins then Crashes)

Hello. I have a problem where Unity’s code cannot finish executing, and therefore it cannot reach playmode. I don’t know what the issue is, or where to start looking. It just started suddenly while I was tweaking a script dealing with just gameObject positions.

Basically what happens is I get this message, and then Unity eats 32gb of ram. I’ve tried clearing the cache, but it didn’t have any effect.

9786924--1404213--upload_2024-4-22_20-33-10.png

did you try deleting the library folder too?

Did you undo your “tweaks”?

You may have caused an infinite loop.

One sure way to do so is to Instantiate(this.gameObject) in Awake, Start or OnEnable because the new instance will do the same Instantiate() immediately, infinitely spawning one more object for every object spawned.