24 lines
821 B
Markdown
24 lines
821 B
Markdown
```gdscript
|
|
func display_layer_data():
|
|
# Assume TileMapLayer node is referenced as 'tile_map_layer'
|
|
var tile_set = self.tile_set
|
|
|
|
# Get the number of TileSetSources (sources in tileset)
|
|
var source_count = tile_set.get_source_count()
|
|
|
|
print("Number of sources in TileSet: ", source_count)
|
|
|
|
# Iterate over all sources in the tileset
|
|
for i in range(source_count):
|
|
var source_id = tile_set.get_source_id(i) # integer ID of source (atlas source)
|
|
|
|
# Get the source resource
|
|
var source = tile_set.get_source(source_id)
|
|
|
|
# Check if this source is an Atlas type source
|
|
if source is TileSetAtlasSource:
|
|
print("Found Atlas Source ID: ", source_id)
|
|
print("Atlas Grid Size: ", source.get_atlas_grid_size())
|
|
# You can now use this source_id as the valid atlas source ID assigned to the TileMapLayer
|
|
```
|
|
|