Open1

Rect内でボタンのタッチ判定をする方法

piffettpiffett

ScreenPointToLocalPointInRectangleを使う

if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            Vector2 localPoint;
            RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, Input.mousePosition, Camera.main, out localPoint);
            if (rectTransform.rect.Contains(localPoint))
            {
               // 処理
            }
        }