Skip to content

Commit 64c42a4

Browse files
Update ReferenceDrawer.cs
1 parent 693da10 commit 64c42a4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Editor/Drawers/ReferenceDrawer.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,21 @@ private void HandleDragPerform()
226226
break;
227227
case DragAndDropMode.Unity:
228228
ModeValue = ReferenceMode.Unity;
229-
PropertyValue = DragAndDrop.objectReferences[0];
229+
PropertyValue = GetUnityObject(DragAndDrop.objectReferences[0]);
230230
break;
231231
case DragAndDropMode.None:
232232
default:
233233
throw new ArgumentOutOfRangeException();
234234
}
235235
}
236236

237+
private Object GetUnityObject(Object objectReference)
238+
{
239+
if(objectReference is GameObject gameObject)
240+
return gameObject.GetComponent(GenericType);
241+
return objectReference;
242+
}
243+
237244
protected abstract void PingObject();
238245
}
239246
}

0 commit comments

Comments
 (0)