Skip to content

Commit 12a1055

Browse files
authored
Fix exceptions being thrown in input tester scene when old input is disabled (#835)
1 parent a5e4af2 commit 12a1055

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

Assets/Samples/InputDeviceTester/Scripts/EventsystemPicker.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public class EventsystemPicker : MonoBehaviour
1717
void Start()
1818
{
1919
m_toggles = GetComponent<ToggleGroup>().ActiveToggles();
20+
m_oldSystem.enabled = false;
21+
m_newSystem.enabled = true;
22+
2023
foreach (Toggle toggle in m_toggles)
2124
{
2225
toggle.onValueChanged.AddListener(delegate {

Assets/Samples/InputDeviceTester/Scripts/Input/ControllerDiagramOldInput.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
public class ControllerDiagramOldInput : GamepadOldInput
44
{
5+
#if ENABLE_LEGACY_INPUT_MANAGER
56
// Update is called once per frame
67
void Update()
78
{
@@ -57,4 +58,6 @@ private Color RemoveColorTranparency(Color color)
5758
color.a = 1f;
5859
return color;
5960
}
61+
62+
#endif
6063
}

Assets/Samples/InputDeviceTester/Scripts/Input/DualShockOldInput.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class DualShockOldInput : GamepadOldInput
1818
private List<DualShockTrigger> m_dualShockTriggers = new List<DualShockTrigger>();
1919
private readonly Color m_stickButtonColor = new Color(0.4f, 0.4f, 0.55f, 1f); // The default color for Stick when it is NOT pressed.
2020

21+
#if ENABLE_LEGACY_INPUT_MANAGER
2122
// Start is called before the first frame update
2223
void Start()
2324
{
@@ -145,6 +146,8 @@ protected override void StopHighlightButton(string buttonName)
145146
}
146147
}
147148
}
149+
150+
#endif
148151
}
149152

150153
// This is for DualShock controller triggers on Windows and OSX

Assets/Samples/InputDeviceTester/Scripts/Input/GamepadOldInput.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class GamepadOldInput : MonoBehaviour
2525
protected List<AnalogStick> analog_sticks = new List<AnalogStick>();
2626
protected List<AnalogButton> analog_buttons = new List<AnalogButton>();
2727

28+
#if ENABLE_LEGACY_INPUT_MANAGER
2829
protected void UpdateAllButtons()
2930
{
3031
foreach (KeyCode kcode in Enum.GetValues(typeof(KeyCode)))
@@ -141,6 +142,8 @@ protected void ShowMessage(string msg)
141142
{
142143
m_MessageWindow.text += "<color=blue>" + msg + "</color>\n";
143144
}
145+
146+
#endif
144147
}
145148

146149
[Serializable]

Assets/Samples/InputDeviceTester/Scripts/Input/KeyboardMouseOldInput.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class KeyboardMouseOldInput : MonoBehaviour
1414
public Text m_keyboardInfoText;
1515
public Text m_mouseInfoText;
1616

17+
#if ENABLE_LEGACY_INPUT_MANAGER
1718
void Update()
1819
{
1920
// Keyboard input or mouse button is pressed
@@ -150,4 +151,6 @@ private void ShowMessage(string msg)
150151
{
151152
m_MessageWindow.text += "<color=blue>" + msg + "</color>\n";
152153
}
154+
155+
#endif
153156
}

Assets/Samples/InputDeviceTester/Scripts/Input/XboxOldInput.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class XboxOldInput : GamepadOldInput
1818
private List<XboxTrigger> xbox_triggers = new List<XboxTrigger>();
1919
private readonly Color m_stickButtonColor = new Color(0.4f, 0.4f, 0.55f, 1f); // The default color for Stick when it is NOT pressed.
2020

21+
#if ENABLE_LEGACY_INPUT_MANAGER
2122
// Use this for initialization
2223
void Start()
2324
{
@@ -143,6 +144,8 @@ protected override void StopHighlightButton(string buttonName)
143144
}
144145
}
145146
}
147+
148+
#endif
146149
}
147150

148151
// This is for xbox controller triggers on MacOS ONLY

0 commit comments

Comments
 (0)