alttester / alttester/AltTester-Unity-SDK

Click execution fails on custom button due to incomplete pointer event sequence

Đang mở
#1,844 1 bình luận 0 reaction 1 người được giao Được @RobertPoienar nhận Xem trên GitHub
bug From Users postponed
Ngôn ngữ chính
C#
Star
121
Fork
24
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Description:

The problem is that the custom Button requires a specific sequence of pointer events to be fired for a click to register successfully. The custom button has strict validation checks in its OnPointerUp() method that are not currently being met.

For a click to be valid, the following conditions must be true:

1. isPointerInside must be true (which requires OnPointerEnter to be called first).
2. !isDragging and !eventData.dragging must be true.
3. pointerPress and raycast data must be properly set.

Currently, AltTester only executes the pointerUpHandler, which is insufficient to set the required state on the custom button.

### Proposed Fix:

To resolve this, AltTester must simulate the complete pointer event sequence: OnPointerEnter, OnPointerDown, and then OnPointerUp.

The following code demonstrates the required implementation:

```
var pointerEventData = new PointerEventData(EventSystem.current)
{
position = screenPosition,
button = PointerEventData.InputButton.Left,
eligibleForClick = true,
pressPosition = screenPosition,
pointerPress = eventSystemTarget,
pointerCurrentRaycast = new RaycastResult { gameObject = eventSystemTarget }
};

// Step 1: OnPointerEnter (sets isPointerInside = true)
ExecuteEvents.ExecuteHierarchy(eventSystemTarget, pointerEventData, ExecuteEvents.pointerEnterHandler);

// Step 2: OnPointerDown (sets required state for the click)
ExecuteEvents.ExecuteHierarchy(eventSystemTarget, pointerEventData, ExecuteEvents.pointerDownHandler);

// Step 3: OnPointerUp (now triggers the click successfully)
ExecuteEvents.ExecuteHierarchy(eventSystemTarget, pointerEventData, ExecuteEvents.pointerUpHandler);

```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.