Files
TEngine/UnityProject/Assets/Editor/ReferenceFinder/DragAreaGetObject.cs
2025-05-26 15:07:50 +08:00

29 lines
819 B
C#

using UnityEditor;
using UnityEngine;
namespace TEngine.Editor
{
internal sealed class DragAreaGetObject
{
public static Object[] GetObjects(string meg = null)
{
Event aEvent = Event.current;
GUI.contentColor = Color.white;
if (aEvent.type is EventType.DragUpdated or EventType.DragPerform)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
bool needReturn = false;
if (aEvent.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
needReturn = true;
}
Event.current.Use();
if (needReturn) return DragAndDrop.objectReferences;
}
return null;
}
}
}