Are resources duplicated?

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

What happens to the resources when they are loaded in different places in my game? Are they duplicated in the memory or they are loaded once?

:bust_in_silhouette: Reply From: Zylann

They are loaded once. Multiple calls to load using the same resource path will always return the same resource.
Eventually, if at any point, no variable references that resource, it will be unloaded, and if some code uses load, it will be loaded again.

:bust_in_silhouette: Reply From: Xrayez

You can also make a resource local_to_scene so that instancing will force to duplicate the resource so it’s not shared between nodes.