I'm making a JRPG style dungeon crawler, and I'm currently trying to generate the floor. I currently have the ability to generate the floor using the mesh generation code given in the Brackeys tutorial on the same topic. Unfortunately, "for loops" have a nasty habit of locking up Unity until they're done. It's the reason why infinite loops are so dangerous. Because I wanted to show a loading animation while the mesh generates, I decided to do it inside of a coroutine, but then it becomes extremely slow. Even a 32 x 32 grid takes too long to generate.
That's when I learned about Compute shaders. They're apparently capable of running a piece of code many times in parallel, thus it seems like the perfect fix.
However, I've been looking into them for several days and I'm still having trouble understanding exactly how they work.
If it's possible, could anyone please push me in the right direction.
↧