DragObj2D

DragObj Public Function, you can inherent override the function or simply call it.

Public Variable
  • string mainCanvasName

  • bool isReturnPosition - Open to return to original position when end drag

  • bool isSwapObj - Open to enable swap obj slot

  • bool dropAsFirstSibling

  • Component m_ObjInfoComponent

- Override Function -

OnBeginDrag()

The function call when the object on begin drag.

Parameter:

  • PointerEventData eventData - pass by the pointer event.

OnDrag()

The function call when the object on drag.

Parameter:

  • PointerEventData eventData - pass by the pointer event.

OnEndDrag()

The function call when the object on end drag.

Parameter:

  • PointerEventData eventData - pass by the pointer event.

- Public Function -

Initialize()

Initialize the DragObj Info by script.

Parameter:

  • Component component - data structure need to stored by dragobj.

  • string canvasName - main canvas name

SetDropParent()

Change the drag object parent to given transform.

Parameter:

  • Transform transform - transform of the drop parent.

SetRectPosition()

Change the drag object position to given Vector2 position.

Parameter:

  • Vector2 position - x-y position that want the drag object to be.

SetInitialPosition()

Set the drag object position to its own initial position.

Last updated

Was this helpful?