1、要想实现某个widget的拖拽,只需要添加一个UIDragObject脚本组件。
public Transform target;
public Vector3 scale = Vector3.one;
public float scrollWheelFactor = 0f;
public bool restrictWithinPanel = false;
public DragEffect dragEffect = DragEffect.MomentumAndSpring;
public float momentumAmount = 35f;
target为被移动的界面。假如在某个界面A上添加了UIDragObject组件,然后将target指向某个window,则当我们在界面A上拖到鼠标时,window会做相应的移动。
scale设置移动方向和移动速度。例如:把scale.x设置成10,横向拖到窗口你会发现窗口移动的速度明显比光标快!把scale.x设置成-1&