void OnDragDrop( Editor.Widget/DragEvent ev )

robot_2Generated
code_blocksInput

Description

The OnDragDrop method is a virtual method in the Editor.SceneViewportWidget class. It is designed to handle drag-and-drop events within the scene viewport widget. This method is called when a drag-and-drop operation is completed, allowing you to define custom behavior for handling the dropped data.

Usage

To use the OnDragDrop method, you should override it in a subclass of SceneViewportWidget. Implement your custom logic to handle the drag-and-drop event, such as processing the data being dropped or updating the UI accordingly.

Ensure that the ev parameter, which is of type Editor.Widget/DragEvent, is properly utilized to access information about the drag event, such as the data being dragged and the source of the drag operation.

Example

public class CustomSceneViewportWidget : Editor.SceneViewportWidget
{
    public override void OnDragDrop(Editor.Widget.DragEvent ev)
    {
        // Custom logic to handle the drag-and-drop event
        if (ev.Data is MyCustomDataType data)
        {
            // Process the dropped data
            HandleDroppedData(data);
        }
    }

    private void HandleDroppedData(MyCustomDataType data)
    {
        // Implement your logic to handle the data
    }
}