public void GetSGandSlottableUnderCursor(ref Slottable sbUnderCursor, ref SlotGroup sgUnderCursor, PointerEventData eventData) { // sgUnderCursor = null; // sbUnderCursor = null; if (sgUnderCursor != null && !RectTransformUtility.RectangleContainsScreenPoint(sgUnderCursor.m_dropZoneRect, eventData.position)) { sgUnderCursor.SetHoverState(false); sgUnderCursor = null; m_sgUnderCursor = null; } // if(sbUnderCursor != null && !RectTransformUtility.RectangleContainsScreenPoint(sbUnderCursor.m_rectTrans, eventData.position)){ // sbUnderCursor = null; // sbUnderCursor // m_sgUnderCursor = null; // } for (int i = 0; i < m_slotGroups.Count; i++) { if (m_slotGroups[i].m_isActiveForSelection) { if (RectTransformUtility.RectangleContainsScreenPoint(m_slotGroups[i].m_dropZoneRect, eventData.position)) { if (sgUnderCursor == m_slotGroups[i] /*&& sgUnderCursor != null*/) { //do nothing } else { if (sgUnderCursor != null) { sgUnderCursor.SetHoverState(false); } m_slotGroups[i].SetHoverState(true); sgUnderCursor = m_slotGroups[i]; m_sgUnderCursor = sgUnderCursor; } } Slottable prevSlottableUnderCursor = sbUnderCursor; if (m_slotGroups[i].CheckAllSlottablesForCursorHover(eventData, ref sbUnderCursor)) { if (sbUnderCursor == prevSlottableUnderCursor) { //do nothing } else { if (prevSlottableUnderCursor != null) { prevSlottableUnderCursor.SetHoverState(false); } sbUnderCursor.SetHoverState(true); m_sbUnderCursor = sbUnderCursor; } return; } } } }