We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd8201a commit 688e8f3Copy full SHA for 688e8f3
CrazyCar/Assets/Scripts/Game/GameCtrBtn.cs
@@ -8,25 +8,17 @@
8
public class GameCtrBtn : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
9
private Action clickDown;
10
private Action clickUp;
11
- private bool isClickDown = false;
12
-
13
- private void Update() {
14
- if (isClickDown) {
15
- clickDown?.Invoke();
16
- }
17
18
19
public void SetClick(Action clickDown = null, Action clickUp = null) {
20
this.clickDown = clickDown;
21
this.clickUp = clickUp;
22
}
23
24
public void OnPointerDown(PointerEventData eventData) {
25
- isClickDown = true;
+ clickDown?.Invoke();
26
27
28
public void OnPointerUp(PointerEventData eventData) {
29
- isClickDown = false;
30
clickUp?.Invoke();
31
32
0 commit comments