Queue and Threading

How would I go about making a queue, I have tried a couple of things but never got it working. So do you have any good points to start on this? :slight_smile:
I am trying to queueing something on another thread and then when it is done it executes some script on the mainThread, and then goes on to the next in the line.

Yeah, I know that unity isn’t thread safe and so on, but I needed this feature to make the terrain generate without having that 1 second lag…
I don’t use Random on the other thread, only on the main thread…

Wow, I feel really stupid now, I could just have used yield null; in the for loop each time z equals heightmapWidth, it would take some time for the terrain to be assigned, but that doesn’t matter because the viewdistance isn’t far enough to see the new generated terrain, while it is loading.