Loading gridmap in the background

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PGamer

I have a script connected to a gridmap that generates terrain but if I make the chunck var (terrain size) a bit bigger it takes a lot of time to load (doesn’t affect FPS), is there any way to make the loading faster or preloading the gridmap?

extends GridMap

var noise := OpenSimplexNoise.new()
var chunk = 32

func _ready()->void:
  for x in range(chunk):
    for y in range(30):
      for z in range(chunk):
        if y < noise.get_noise_2d(x, z)*5+10:
         set_cell_item(x,y,z,0)