Commit 94f09f1 1 parent 7278338 commit 94f09f1 Copy full SHA for 94f09f1
File tree 2 files changed +44
-8
lines changed
Runtime/Input/InteractionBehaviours
2 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -34,18 +34,36 @@ public class ButtonClickEvent : UnityEvent { }
34
34
public ButtonClickEvent Click => click ;
35
35
36
36
/// <inheritdoc/>
37
- protected override void OnSelectEntered ( InteractionEventArgs eventArgs )
37
+ protected override void OnFirstSelectEntered ( InteractionEventArgs eventArgs )
38
38
{
39
- if ( raiseOnInputDown )
39
+ if ( raiseOnInputDown && ! Interactable . IsGrabbed )
40
40
{
41
41
Click ? . Invoke ( ) ;
42
42
}
43
43
}
44
44
45
45
/// <inheritdoc/>
46
- protected override void OnSelectExited ( InteractionExitEventArgs eventArgs )
46
+ protected override void OnLastSelectExited ( InteractionExitEventArgs eventArgs )
47
47
{
48
- if ( ! raiseOnInputDown )
48
+ if ( ! raiseOnInputDown && ! Interactable . IsGrabbed )
49
+ {
50
+ Click ? . Invoke ( ) ;
51
+ }
52
+ }
53
+
54
+ /// <inheritdoc/>
55
+ protected override void OnFirstGrabEntered ( InteractionEventArgs eventArgs )
56
+ {
57
+ if ( raiseOnInputDown && ! Interactable . IsSelected )
58
+ {
59
+ Click ? . Invoke ( ) ;
60
+ }
61
+ }
62
+
63
+ /// <inheritdoc/>
64
+ protected override void OnLastGrabExited ( InteractionExitEventArgs eventArgs )
65
+ {
66
+ if ( ! raiseOnInputDown && ! Interactable . IsSelected )
49
67
{
50
68
Click ? . Invoke ( ) ;
51
69
}
Original file line number Diff line number Diff line change @@ -61,18 +61,36 @@ public bool IsOn
61
61
public void SetIsOnWithoutNotify ( bool isOn ) => this . isOn = isOn ;
62
62
63
63
/// <inheritdoc/>
64
- protected override void OnSelectEntered ( InteractionEventArgs eventArgs )
64
+ protected override void OnFirstSelectEntered ( InteractionEventArgs eventArgs )
65
65
{
66
- if ( raiseOnInputDown )
66
+ if ( raiseOnInputDown && ! Interactable . IsGrabbed )
67
67
{
68
68
IsOn = ! IsOn ;
69
69
}
70
70
}
71
71
72
72
/// <inheritdoc/>
73
- protected override void OnSelectExited ( InteractionExitEventArgs eventArgs )
73
+ protected override void OnLastSelectExited ( InteractionExitEventArgs eventArgs )
74
74
{
75
- if ( ! raiseOnInputDown )
75
+ if ( ! raiseOnInputDown && ! Interactable . IsGrabbed )
76
+ {
77
+ IsOn = ! IsOn ;
78
+ }
79
+ }
80
+
81
+ /// <inheritdoc/>
82
+ protected override void OnFirstGrabEntered ( InteractionEventArgs eventArgs )
83
+ {
84
+ if ( raiseOnInputDown && ! Interactable . IsSelected )
85
+ {
86
+ IsOn = ! IsOn ;
87
+ }
88
+ }
89
+
90
+ /// <inheritdoc/>
91
+ protected override void OnLastGrabExited ( InteractionExitEventArgs eventArgs )
92
+ {
93
+ if ( ! raiseOnInputDown && ! Interactable . IsSelected )
76
94
{
77
95
IsOn = ! IsOn ;
78
96
}
You can’t perform that action at this time.
0 commit comments