17 lines
516 B
Markdown
17 lines
516 B
Markdown
# UIExtension UXDraggable 拖拽模块手册
|
|
|
|
## 模块概述
|
|
`UXDraggable` 把拖拽生命周期包装为 `UnityEvent<PointerEventData>`,便于直接在 Inspector 或代码中订阅。
|
|
|
|
## 可调用 API
|
|
源码:`Packages/com.alicizax.unity.ui.extension/Runtime/UXComponent/Drag/UXDraggable.cs`
|
|
- `onDrag`
|
|
- `onBeginDrag`
|
|
- `onEndDrag`
|
|
|
|
## 快速上手
|
|
```csharp
|
|
var draggable = gameObject.AddComponent<UnityEngine.UI.UXDraggable>();
|
|
draggable.onBeginDrag.AddListener(_ => UnityEngine.Debug.Log("Begin"));
|
|
```
|