I have the same problem, and in my solution chunks are Actors, and each of them contains Instanced Static Meshes for every possible block type (though there’s only one block type I’ve added).
I’ve thought of stagger spawning chunks in my first post on the forum (if I understand what that means correctly), but ended up with pool system, so now when i push chunk to pool, I clear all instances of all ISMs, and when I pull from pool, i create lots of instances according to terrain generation algorithm (which i didn’t managed to set up yet). All of these operations cost a lot of time and there’s no surprise that game freezes every time chunks need to be created/deleted.
Because pool system for chunks work pretty well, I think I shuouldn’t touch that part of my code, however, I still need to deal with instances of ISMs, and i think stagger spawn will be the best solution for that case, so i still wonder how to set it up properly, so any advice would be helpful.
PS: I also wonder, if it’s possible to deal with this problem by using multithreading, and if so, what should I do to safely use ISM::AddInstanse()
and ISM::ClearInstances()
in any thread.