multiple tilemap with the same image, how godot load it?

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

In one scene i have multiple scenes, In everyone i have multiple tilemaps with the same image(because i change tiles in script for every tilemap ), i’m worried because according my calcules i’m going to have 30 + tilemaps with the same image when i finish,

How godot are going to work with that? he load 30 tileset and one image or use one tileset/one image for every tilemap or load 30 images and 30 tilemaps. (?

:bust_in_silhouette: Reply From: hilfazer

Image is a Resource and since Reasources are cached it will be loaded only once.

Go to ‘Project->Project Settings->General->Debug->Settings’ and check ‘Verbose Stdout’. It will show you how many times resources were requested and how many times cache was used.

This is and output i’ve got:

load resource: res://default_env.tres
load resource: res://main.tscn
load resource: res://main.gd
load resource: res://TS.tres
load resource: res://icon.png
load resource: res://icon.png (cached)
load resource: res://icon.png (cached)
load resource: res://icon.png (cached)
load resource: res://icon.png (cached)
load resource: res://icon.png (cached)
load resource: res://icon.png (cached)
load resource: res://main.gd (cached)
load resource: res://TS.tres (cached)
load resource: res://TS.tres (cached)
load resource: res://TS.tres (cached)
load resource: res://TS.tres (cached)

I had a tileset with 6 tiles, each using icon.png.
main.tscn had 4 tilemaps using this tileset.

Thank you , that was exactly what I wanted to see, i didn’t know that option

crossbit | 2019-02-03 20:29