Thank you for the screenshots, I was able to find the bug and fix it, by replicating your setup.
There are two issues, both cause by the object pooling
1) Pooling moves the UI to another gameobject when it is returned to the pool. That object is not a canvas and that seems to be causing the negative width/height
To fix that add this on line 325 of the Item Shape Grid script:
Code:
view.RectTransform.sizeDelta = m_ItemShapeSize;
right below the if condition and the line where I assigne the anchoredPosition
2) For some reason the Item View in the foreground stops ignoring raycasts which block the background from receiving the UI events. I use the background item view to receive raycasts because they are of fixed size.
To fix that replace this function in the Item Shape Item View script around line 230:
Code:
/// <summary>
/// Change the layer state between foreground and background.
/// </summary>
/// <param name="foreground">Is it foreground or background?</param>
protected virtual void ChangeLayerState(bool foreground)
{
m_Foreground = foreground;
if (m_Foreground) {
m_ForegroundItemView = null;
}
m_View.CanvasGroup.interactable = !foreground;
m_View.CanvasGroup.blocksRaycasts = !foreground;
for (int i = 0; i < m_ForegroundActive.Length; i++) {
m_ForegroundActive[i].SetActive(m_Foreground);
}
for (int i = 0; i < m_BackgroundActive.Length; i++) {
m_BackgroundActive[i].SetActive(m_Foreground == false);
}
}