Position object over center of cell of Grid Layout Group
Hello,
I can't find any method witch allow me to center an object over center of cell of Grid Layout Group. There is Grid object with Grid Layout Group and with Cell objects within it. And draggable object. When I drag and drop object over cell I want to center with it.
I could make draggable object parent of cell, but the issue is object can be bigger than one cell.
Each cell implements IDropHandler
public void OnDrop(PointerEventData eventData)
{
GameObject itemObject = eventData.pointerDrag;
if (itemObject != null)
{
//itemObject.transform.SetParent(transform);
//itemObject.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
}
}
screen-shot-2021-01-13-at-201200.png
(10.2 kB)
screen-shot-2021-01-13-at-201649.png
(22.0 kB)
Comment
Your answer
Follow this Question
Related Questions
Liquid layout - grid layout Group 0 Answers
¿Como puedo hacer un Grid como Editor solo con ciertas medidas en 2D? (Como Geometry Dash) 0 Answers
Dynamic textbox within panel contraint 0 Answers
Ui layout elements keep reverting after taken outside of grid element 0 Answers
Special Grid layout 0 Answers