Loading a resource in separate instances

Godot Version

Godot 4.2.1 stable


I’m curious if there is some way to preload a resource in a way where it is a “different” resource from another one that is loaded at the same time.

Currently I’m managing a material gathering system through resources, where each individual material that you can harvest from stems from a resource that holds it’s information (health, output, respawn time, etc.).

Before I was using placeholder StaticBody2Ds that took the material resource as an input, and then managed the transfer of player input, and that worked fine, but my issue was that having a million of the “placeholder” material nodes all over the place would get annoying so I opted for a system where the materials are held in an dictionary based on their location, and then once the player got close enough it would temporary place an interactable object that allowed the player to interact with the material. The issue is, each of these individual materials are all the same resource, and since I’m no longer assigning them to an independent instant of a scene right away, they do differentiate from each other. Is there something that I’m missing that allows me to make self sufficient “instances” (since .instantiate() doesn’t work) through the code? Thanks.

Dictionary screenshot (The createResource() method is a custom method that setups all of the random variables for that material “instance”)

Honestly would need to see more code. Include createResource()

TIP: You can post code here using the </> tool above. You don’t need a screenshot.