Hi,
I’m making a custom editor for my ScriptableObject that are using AssetReferenceSprite.
As I’m using UI Toolkit as recommended for 2022.3, I learned in this thread that I should use
SearchService.ShowPicker instead of EditorGUIUtility.ShowObjectPicker.
I’m able to find my addressable sprites in the picker with the searchText
“t:Sprite is:subasset” in the search context and when I select a sprite, I end up in the
SearchViewState selectHandler callback with a SearchItem. (is:subasset allows me to have only the addressable entry and not the sprite itself, removing all duplicated from the search results)
Now I’m lost, how am I supposed to use the SearchItem to correctly fill the SerializedProperty of my SO with the sprite reference ?
In this code Unity - Manual: Registering an Action Handler, item.id seems to be used to load the asset but when used with
Addressables.LoadAssetAsync(item.id) I get a key error.
I also tried with AssetDatabase.LoadAssetAtPath(item.id); as in the link above but it always returns null (maybe because I searched for subitem ?)
item.id according to the doc is a unique id for the search result but does not seems to be an addressable guid.