So I’m making this procedural level generator which can take quite a lot of time to run. Therefore I am thinking it should be put into a coroutine or thread to not freeze the game. However the algorithm in question uses things like Find() and .transform to determine parts of the generation. This creates two problems
-
If I use the coroutine, the game still freezes upon starting.
-
If I use another thread, I cannot use the .transform or Find() functions/objects etc.
What is the recommended solution for this problem? What am I doing wrong?