public DragPreview Create(Transform parent, InventoryObject obj)//, Vector3 position) { DragPreview dp = Instantiate(gameObject, parent).GetComponent <DragPreview>(); dp._image.sprite = obj.Icon; //dp._image.SetNativeSize(); return(dp); }
public virtual void OnEndDrag(PointerEventData eventData) { if (_dragPreview != null) { Destroy(_dragPreview.gameObject); _dragPreview = null; } OnObjectEndDragHandler?.Invoke(this); }
public virtual void OnBeginDrag(PointerEventData eventData) { if (canvas == null) { return; } if (_object != null) { _dragPreview = _dragPreviewTemplate.Create(transform, _object);// transform.position); _dragPreview.transform.SetAsLastSibling(); OnObjectBeginDragHandler?.Invoke(this, _object); OnDrag(eventData); } }