- Home /
Retrieve Array of Texture2Ds dropped in EditorWindow ObjectField
Hello!
How would I retrieve an array of Texture2Ds that are dropped onto an ObjectField in an EditorWindow with a typeof Sprite?
I'm quite familiar with editor/inspector scripting, but this one has me stumped.
Any assistance is much appreciated!
Thank you in advance. :) - S.
You mean a script public attribute, which are accesible from the inspector view on the script component?
or the materials on a Skinner $$anonymous$$esh Renderer :
@viiarge: Thank you for your response!
Alas not. I've achieved the result I seek in an Inspector using SerializedObject/SerializedProperties. Unfortunately, I'm not certain how to implement such a means in an EditorWindow.
Here's a screenshot of my window for clarification:
$$anonymous$$y goal is to allow dragging and dropping of multiple assets into the "Sprite" field. If I can retrieve these assets from the field, the rest of the process becomes trivial.
ObjectField using a base type only detects one of the assets. Any attempts to have an ObjectField doesn't appear to support an "objType" of an array or list.
Additionally, I've attempted to capture the Event.current.mousePosition and Event.current.type/Event.current.rawType, but the event type doesn't seem to fire when the assets are dropped on the field.
Capturing Selection.gameObjects failed to find any objects if performed immediately after dropping assets onto the field. Also, using tracking the previously-selected objects and updating them using the Selection.selectionChanged delegate doesn't appear to circumvent the aforementioned issue.
Thank you so much again! - S.
Ok, I don't know much about the ObjectField, I though you meant in the inspector. Sorry I couldn't help and Good luck in your research !
@viiarge: No worries! Thank you for taking the time to offer a helping hand. :)