ToString() = guid, how do we get the path?

at runtime.
or the name of the original asset?

1 Like

+1 here, is there a way to get an object name from AssetReference? Just need to load appropriate interface icons from “Resources” folder using name of addressable assets(200+ materials & 200+ prefabs) to find matching icons…
In Editor this works:

public AssetReference MaterialToApply; //Addressable material input in Editor.
....
print(MaterialToApply.editorAsset.ToString().Replace(" (UnityEngine.Material)", ""));
//Outputs usable material name.

But project won’t build with that.

Upd: Probably it’s about https://discussions.unity.com/t/799440/2 - but this is for those who knows addressables in and out, can’t understand syntax & logic - not for amateur programmer like me… Any human-readable example for the simplest case ("public AssetReference MaterialToApply; //How to get actual name/path from the “MaterialToApply”?), please? XD

I don’t think there is a way to get the user-defined address at runtime without building a table yourself, or inheriting the AssetReference type and storing the address there.

After seeing several of these threads, I’ve come to understand that they use the GUID as the RuntimeKey since it’s much more likely to be unique (the only way for it to not be unique is if you load multiple catalogs), and an AssetReference is designed to point to a single, specific asset.

1 Like