Custom data layer - generating dynamic map

Godot Version



I am trying to use TileMap to create custom data on a dynamically generated map.

I load this data from file. I essentially need to store 2 integers for each tile on the map.

Currently, I use own array e.g.

var MapCodeData = []
var MapCodeExtra = []

for y in range(128): 
	for x in range(128):

and I populate that data with what I require. It works.

But I wanted to store it in Custom Data Layer which I believe is for that purpose, but I can’t find any functions to read or write into custom data, and the only thing I can see is that the custom data can be applied per-tile in the tileset. But I want it in the tile map, not tile set and i want to generate it dynamically.

Any ideas how?