@@ -19,20 +19,38 @@ public abstract class Button : MonoBehaviour, IInputHandler, IPointerSpecificFoc
19
19
/// Current Button State
20
20
/// </summary>
21
21
[ Header ( "Basic Settings" ) ]
22
+ [ SerializeField ]
22
23
[ Tooltip ( "Current State of the Button" ) ]
23
- public ButtonStateEnum ButtonState = ButtonStateEnum . Observation ;
24
+ private ButtonStateEnum buttonState = ButtonStateEnum . Observation ;
25
+ public ButtonStateEnum ButtonState
26
+ {
27
+ get { return buttonState ; }
28
+ set { buttonState = value ; }
29
+ }
24
30
25
31
/// <summary>
26
32
/// Filter to apply for the correct button source
27
33
/// </summary>
34
+ [ SerializeField ]
28
35
[ Tooltip ( "Filter for press info for click or press event" ) ]
29
- public InteractionSourcePressInfo ButtonPressFilter = InteractionSourcePressInfo . Select ;
36
+ private InteractionSourcePressInfo buttonPressFilter = InteractionSourcePressInfo . Select ;
37
+ public InteractionSourcePressInfo ButtonPressFilter
38
+ {
39
+ get { return buttonPressFilter ; }
40
+ set { buttonPressFilter = value ; }
41
+ }
30
42
31
43
/// <summary>
32
44
/// If true the interactable will deselect when you look off of the object
33
45
/// </summary>
46
+ [ SerializeField ]
34
47
[ Tooltip ( "If RequireGaze then looking away will deselect object" ) ]
35
- public bool RequireGaze = true ;
48
+ private bool requireGaze = true ;
49
+ public bool RequireGaze
50
+ {
51
+ get { return requireGaze ; }
52
+ set { requireGaze = value ; }
53
+ }
36
54
37
55
/// <summary>
38
56
/// Event to receive button state change
@@ -114,7 +132,7 @@ public void TriggerClicked()
114
132
/// <param name="eventData"></param>
115
133
public void OnInputDown ( InputEventData eventData )
116
134
{
117
- if ( enabled )
135
+ if ( enabled && ! m_disabled )
118
136
{
119
137
if ( ButtonPressFilter == InteractionSourcePressInfo . None || ButtonPressFilter == eventData . PressType )
120
138
{
@@ -133,7 +151,7 @@ public void OnInputDown(InputEventData eventData)
133
151
/// <param name="eventData"></param>
134
152
public void OnInputUp ( InputEventData eventData )
135
153
{
136
- if ( enabled )
154
+ if ( enabled && ! m_disabled )
137
155
{
138
156
if ( ButtonPressFilter == InteractionSourcePressInfo . None || ButtonPressFilter == eventData . PressType )
139
157
{
@@ -148,7 +166,7 @@ public void OnInputUp(InputEventData eventData)
148
166
/// <param name="eventData"></param>
149
167
public void OnInputClicked ( InputClickedEventData eventData )
150
168
{
151
- if ( enabled )
169
+ if ( enabled && ! m_disabled )
152
170
{
153
171
if ( ButtonPressFilter == InteractionSourcePressInfo . None || ButtonPressFilter == eventData . PressType )
154
172
{
0 commit comments