Example #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (analogChildren != null || analogChildren.Length != 0)
        {
            Vector3 worldPos    = Camera.main.ScreenToWorldPoint(eventData.pressPosition);
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(worldPos);
            screenPoint.x -= analogChildren[1].rect.width / 2;
            screenPoint.y -= analogChildren[1].rect.height / 2;
            analogChildren[1].anchoredPosition = screenPoint;


            //Pass event to child
            analogControls.OnPointerDown(eventData);
        }
        rawImage.raycastTarget = false;
    }