private void Update() { // Update the delta always, this helps working around initialization issues :D UpdateDelta(); if (!isActive) { return; } if (!hadInputDownAfterGameStart) { delta = 0f; } // This also works on touch devices if (Input.GetMouseButtonDown(0)) { hadInputDownAfterGameStart = true; PointerDownEvent?.Invoke(); } // This also works on touch devices if (Input.GetMouseButtonUp(0) && hadInputDownAfterGameStart) { PointerUpEvent?.Invoke(); } // This also works on touch devices if (!Input.GetMouseButton(0)) { return; } HorizontalDragEvent?.Invoke(delta); }
public override void OnPointerDown(PointerEventData ped) { OnPressEvent.Invoke(); }