By default, when toggling an asset into Addressable asset, it is using asset file path as key/address/resource location, which is understandable as they are unique.
But I don’t think they are very useful because they are literally the same as path. And in practice, this make finding your asset more difficult due to the long name (imagine adding AssetReference as a serialized field, then selecting an asset from the dropdown UI: all of them will have the same naming prefix, so you have to search and filter, and you still can’t see which is the right result easily.)
I would prefer it to just use the asset name, which may or may not be what everyone wants, so I am wondering, can I override this behavior myself, and avoid manually renaming each asset?
Thx, let me know if you got some good workarounds.
(Note: and I believe the name of an addressable asset doesn’t have to be unique, only underlying hash128 is unique.)
It does not need to be unique. If you have two GameObjects with the address “tank” and say LoadAssets<GameObject>("tank") you’ll get both. If you say LoadAsset<GameObject>("tank") (no s) you’ll only get one. which one? whichever one we find first.
as to the default naming, which was the point of this thread, that’s a good idea. Would you think it would work if you could just provide Addressables with some sort of “name function”? (string NameFunc(string path))
Alternatively, if there is a way to add items to Addressable via code, which allow setting a custom name, that’s good too. (This is useful when we create ScriptabObject asset, save us the trouble of toggling Addressable checkbox and set a proper name manually)