Trying to load a custom resource using the object, not a string

Godot Version

4.2.2

Question

Hello, relative baby at this, tried the documentation and googling but can’t seem to find quite what I’m looking for. In my project, I will have a lot of items, and right now I am seeing how creating Custom Resources will work out for those. To help group those items based on what headers they will go under in the item shop in the game, I created another type of Custom Resource that is basically just a dictionary where I give each item a key and assign the individual item Custom Resource using the editor. So essentially, I have a Custom Resource containing Custom Resources in a dictionary so I can use the dictionary to iterate through the resources. The problem I am currently facing is when I try to load the resource within a resource, what I actually have is an object, when the load function wants a string. How do I load a resource using that? Thanks!

you dont need to load it anymore since you already have the object in the dictionary. When you load your ResourceDictionary it already loaded all the resources with it so you can just use them directly. And if it doesnt work like this please elaborate on how you set up the dictionary: what are the keys? and what are the values?

1 Like

Oh huh neat, I tried it without any kind of load statement and it works like you said, thanks! So when I load one custom resource, does it effectively cascade through anything included in that resource and load everything within it, then potentially again and again? Like if this second level of resources I had in the dictionary also had custom resources within them, it just keeps going because I am referring to them directly as objects instead of as paths?

Yes if you load a resource it also loads everything inside of it

1 Like