I am creating a procedurally generated voxel world, like minecraft, and I want to add loading screen while the world is loading. I think I should be able to do this with yield, but don't know how.
My project looks like this:
World script: extends Spatial, is on the root node, generates chunks(only the data, if its air, stone dirt or whatever), then after that, generates the mesh of the chunks, based on their and their neighbours data.
Chunk script: extends nothing, has "classname Chunk" on top, in "init()" function generates block data, that it stores, and in "drawchunk()" creates a SurfaceTool and calls "drawblock()" function on its blocks
Block script: extends nothing, "classname Block" on top, in "init()" function sets its position, and parentChunk, in" drawblock()" function adds vertices uvs and normals to SurfaceTool.
WorldData script: extends Resource, contains world data like chunk size etc. I load it as a resource to each script
Also, I appreciate any advice to restructure my code, I have a feeling there are better ways.
Edit: The "draw_chunk()" method on Chunk returns the MeshInstance created in it, so it can be added to the scene as child