Description
The OnDragDrop
method is a virtual method in the Editor.ComponentSheet
class. It is designed to handle drag-and-drop events within the component sheet, which is used to edit a component's properties in the GameObjectInspector. This method is called when a drag-and-drop operation is completed over the component sheet.
Usage
To use the OnDragDrop
method, you can override it in a derived class of Editor.ComponentSheet
to provide custom behavior when a drag-and-drop event occurs. The method takes a single parameter of type Editor.Widget/DragEvent
, which contains information about the drag event.
Example usage:
public class MyComponentSheet : Editor.ComponentSheet
{
public override void OnDragDrop(Editor.Widget.DragEvent ev)
{
// Custom logic for handling the drag-and-drop event
// For example, you might want to check the data being dragged
if (ev.Data is MyCustomDataType data)
{
// Handle the data
}
}
}
Example
public class MyComponentSheet : Editor.ComponentSheet
{
public override void OnDragDrop(Editor.Widget.DragEvent ev)
{
// Custom logic for handling the drag-and-drop event
// For example, you might want to check the data being dragged
if (ev.Data is MyCustomDataType data)
{
// Handle the data
}
}
}