I'm working on a system that uses a custom resource to hold conditions and another resource (let's call it Resource2). If the conditions are met, then the system is supposed to use Resource2.

The problem is that loading Resource1 automatically loads Resource2, even before checking the conditions. This may not be a problem for small resources, but Resource2 can be a container holding big data or even other containers. That's not efficient when I don't even know if I will need it.

Fist I thought I could make Resource1 hold a path to Resource2 instead of a direct reference, but paths are very limiting since they brake if I rename or move my files.

Then I was introduced to UIDsthanks to Godot 4.4. I thought that was perfect since those didn't brake, but other devs on forums told me they are not persistent. Even if they were, there is no way for a Resource to know and pass its UID path, unless I manually get it from the FileSystem.

Then I thought of a middle ground: giving an ID to my custom resources, and making a json file that holds pairs of "ID: path". Then allowing every resource to make sure to update this file if their paths has changed in respect to their IDs.

And things are starting to get ugly and complex. But then It occurs to me that this will not be necessary if there was a way to prevent Godot from automatically loading Resource2 when loading Resource1, and allowing me to load them only if necessary. If there is a class or a method to do this, or even a plugin, a lot of my problems would be resolved!

If not, it would help me if there was a way to allow the resource to pass its resource's UID path from its .uid file! Thanks in advance if anyone can help me!

  • xyz replied to this.

    kuligs2 Nothing is "ditched". You can always use filenames.

    xyz Right, and since filenames can't be repeated in the same folder, it's like having a unique code! Although they can repeat in different folders, so I may just combine folder and fillenames! Thank you!!