public GameObject GetNextObjectTestAlpha(PointerEventData eventData) { List <RaycastResult> raycastResults = new List <RaycastResult>(); EventSystem.current.RaycastAll(eventData, raycastResults); RaycastResult rr = raycastResults.Find((RaycastResult x) => { if (x.gameObject == gameObject) { return(false); } AlphaTest alphaTest = x.gameObject.GetComponent <AlphaTest>(); if (alphaTest == null) { return(true); } else { return(alphaTest.IsAlphaPoint(eventData)); } }); print(rr.gameObject.name); return(rr.gameObject); }
public void OnEndDrag(PointerEventData eventData) { if (eventData.pointerEnter != null) { AlphaTest alphaTest = eventData.pointerEnter.GetComponent <AlphaTest>(); if (alphaTest != null && !alphaTest.IsAlphaPoint(eventData)) { eventData.pointerEnter = alphaTest.GetNextObjectTestAlpha(eventData); } } SendMessage("OnDragFinish", eventData, SendMessageOptions.DontRequireReceiver); }