Migrating a custom editor that allows Drag and Drop of Prefabs

I have a custom editow window that displays a list of prefabs. This displays the name and preview image of each prefabs in the list, and allows the artist to add to the list by dragging a prefab from the project and dropping it on a spot in the list.

I am trying to migrate this whole system to using Addressables. I have modified the code to work with AssetReference types rather then GameObject. However I am unsure of how to go from the dropped Object to an AssetReferece in code.

Previously it looked like this:

prefab.prefab = (GameObject)EditorGUIUtility.GetObjectPickerObject();

EDIT: Actually that code is from another section where we display the object picker to let the artist select the prefab that way, so oops. The Drag and Drop way we have in another section of code that is getting the object from DragAndDrop.objectReferences, but I’m sure the answer to one is the answer to both.

An addendum to this, how would I do the equivalent of an ObjectField control for an AssetReference?

The best advice I can give you is to look at our package code. Assuming you can find where the package is installed on your computer, you should be able to view the code. Look at com.unity.addressables/Editor/GUI/AssetReferenceDrawer.cs for reference.

Thanks for trying out the system,
Bill