- Home /
Question is off-topic or not relevant
Correctly threading calculations
Hey! So I'm having some trouble here. My game has procedural terrain and all the calculations are done on the main thread which causes alot of lag spikes. I tried to separate the calculations in to another thread then set the values in the main thread but I'm having trouble doing it right. How do I know when the thread is done doing the calculations so I know when to set the data in the main thread. How do I manage to get out of the new thread to set the data in the main thread. How do I do this without having holes in the players view because some chunks are taking longer then others to load. I just need to know theses things so I can do it right without having weird issues like I do right now and I am also working around issues like getting out of the new thread to set the data in the main thread for the mesh in weird and I think bad ways. Any help is appreciated!
Sorry but this question is not Unity related and not specific enough. The only viable answer would be a generic C# threading answer which probably wouldn't be compatible with your code (which we don't know anything about). Threading and proper synchronisation is just basic knowledge about multithreading. There are countless questions on that topic here on UA and on more generic program$$anonymous$$g question sites like StackOverflow.
I'll close this question since it's off topic, not specific enough and too generic.