Hi all
I'm trying to bash together a SpriteData PropertyAttribute with a custom property drawer:

It's not a perfect copy of the atlas and sprite fields that NGUI draws in the inspector, but it's at a stage where it's working pretty well.
The only problem I have is that I can't select sprites. I'm using the following code to build the "Sprite" button:
if (GUI
.Button(new Rect
(position
.x, position
.y,
PREFIX_BUTTON_WIDTH, position.height), "Sprite"))
{
NGUISettings.atlas = atlas.objectReferenceValue as UIAtlas;
NGUISettings.selectedSprite = sp.stringValue;
SpriteSelector.Show((string spriteName) => SelectSprite(serializedObject,
prop.FindPropertyRelative("m_SpriteName"),
sp.stringValue));
}
/// <summary>
/// Sprite selection callback function.
/// </summary>
private void SelectSprite(SerializedObject serializedObject, SerializedProperty serializedProperty,
string spriteName)
{
Debug.Log(spriteName);
serializedObject.Update();
serializedProperty.stringValue = spriteName;
serializedObject.ApplyModifiedProperties();
NGUISettings.selectedSprite = spriteName;
}
When I press the "Sprite" button I get the SpriteSelector window, but when I click on sprites I get a debugged sprite name of "":

Furthermore, I can see that the typical green rect is not drawn on the sprites in the editor window, indicating to me that I don't seem to be making any meaningful selection.
Opening sprite selector from UISprite:

Opening sprite selector from custom property drawer:

I'm attaching the property and the drawer in case anyone wants to take a look. It's pretty short but the drawer gets messy.
If anyone has any ideas on how I can get the SpriteSelector to work, I'd love to hear them.
Thanks,
Ves