I’ve been experimenting with Addressables and I’m trying to understand how I can use various lookup methods in combination with each other. For instance, it’s awesome to be able to get all assets with a certain label (give me all abilities, all weapons, etc), but I’m stumped when it comes to using that in conjunction with AssetReferences.
Say I use an AssetReference field somewhere in the game to refer to a particular player ability and try to compare the PrimaryKey of it to the one I got earlier from a ResourceLocation loaded via an AssetLabelRerence. To make up an example: I’ll use “FireBasedAbilities” label to get the ResourceLocations of all fire based ability assets, and then I’ll compare AssetReference of a particular ability to the PrimaryKeys of those locations to figure out whether this is a fire based ability.
Even though Addressables can give me the exact same asset using either AssetReference PrimaryKey or ResourceLocation key, there does not appear to be a synchronously comparable equivalence between the two. AssetReference keys appear to be guid strings, whereas ResourceLocation keys are file path strings. I can get a ResourceLocation using the key of the AssetReference, but that’s an async call, and I’d rather avoid doing that mid-game for things that are supposed to be near instantaneous equality checks.
Question 1) Is there a synchronous conversion between AssetReference and ResourceLocation keys that I have missed?
Question 2) More of a suggestion but, would it perhaps be possible to have AssetLocationReference objects that would work exactly like AssetReference except they would use the same key format as ResourceLocation?