Skip to content

Commit 900b475

Browse files
authored
Merge branch 'develop' into docs-quality-week-2024-mouse
2 parents 876f6ae + 4b4ed00 commit 900b475

27 files changed

+804
-238
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ however, it has to be formatted properly to pass verification tests.
3030
- Fixed tooltip support in the UI Toolkit version of the Input Actions Asset editor.
3131
- Fixed documentation to clarify bindings with modifiers `overrideModifiersNeedToBePressedFirst` configuration [ISXB-806](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-806).
3232
- Fixed an issue in `Samples/Visualizers/GamepadVisualizer.unity` sample where the visualization wouldn't handle device disconnects or current device changes properly (ISXB-1243).
33+
- Fixed an issue when displaying Serialized InputAction's Processor properties inside the Inspector window. [ISXB-1269](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1269)
3334

3435
### Changed
3536
- Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086).
3637
- Changed `OnScreenControl` to automaticaly switch, in Single Player with autoswitch enabled, to the target device control scheme when the first component is enabled to prevent bad interactions when it start.
3738
- Changed paremeter `overrideModifiersNeedToBePressedFirst` to obsolete for `ButtonWithOneModifier`, `ButtonWithTwoModifiers`, `OneModifierComposite` and `TwoModifiersComposite` in favour the new `modifiersOrder` parameter which is more explicit.
3839
- Changed `Samples/Visualizers/GamepadVisualizer.unity` to visualize the control values of the current device instead of the first device.
3940

41+
### Added
42+
- Added new API `InputSystem.settings.useIMGUIEditorForAssets` that should be used in custom `InputParameterEditor` that use both IMGUI and UI Toolkit.
43+
4044
## [1.11.2] - 2024-10-16
4145

4246
### Fixed

Packages/com.unity.inputsystem/DocCodeSamples.Tests.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Unity.InputSystem.DocCodeSamples",
3+
"rootNamespace": "",
4+
"references": [
5+
"GUID:75469ad4d38634e559750d17036d5f7c"
6+
],
7+
"includePlatforms": [],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": false,
10+
"overrideReferences": true,
11+
"precompiledReferences": [],
12+
"autoReferenced": false,
13+
"defineConstraints": [],
14+
"versionDefines": [],
15+
"noEngineReferences": false
16+
}

Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using UnityEngine;
2+
using UnityEngine.InputSystem;
3+
4+
namespace DocCodeSamples.Tests
5+
{
6+
internal class GamepadExample : MonoBehaviour
7+
{
8+
void Start()
9+
{
10+
// Print all connected gamepads
11+
Debug.Log(string.Join("\n", Gamepad.all));
12+
}
13+
14+
void Update()
15+
{
16+
var gamepad = Gamepad.current;
17+
18+
// No gamepad connected.
19+
if (gamepad == null)
20+
{
21+
return;
22+
}
23+
24+
// Check if "Button North" was pressed this frame
25+
if (gamepad.buttonNorth.wasPressedThisFrame)
26+
{
27+
Debug.Log("Button North was pressed");
28+
}
29+
30+
// Check if the button control is being continuously actuated and read its value
31+
if (gamepad.rightTrigger.IsActuated())
32+
{
33+
Debug.Log("Right trigger value: " + gamepad.rightTrigger.ReadValue());
34+
}
35+
36+
// Read left stick value and perform some code based on the value
37+
Vector2 move = gamepad.leftStick.ReadValue();
38+
{
39+
// Use the Vector2 move for the game logic here
40+
}
41+
42+
// Creating haptic feedback while "Button South" is pressed and stopping it when released.
43+
if (gamepad.buttonSouth.wasPressedThisFrame)
44+
{
45+
gamepad.SetMotorSpeeds(0.2f, 1.0f);
46+
}
47+
else if (gamepad.buttonSouth.wasReleasedThisFrame)
48+
{
49+
gamepad.ResetHaptics();
50+
}
51+
}
52+
}
53+
}

Packages/com.unity.inputsystem/DocCodeSamples.Tests/GamepadExample.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using UnityEngine;
2+
using UnityEngine.InputSystem;
3+
4+
namespace DocCodeSamples.Tests
5+
{
6+
internal class GamepadHapticsExample : MonoBehaviour
7+
{
8+
bool hapticsArePaused = false;
9+
10+
void Update()
11+
{
12+
var gamepad = Gamepad.current;
13+
14+
// No gamepad connected, no need to continue.
15+
if (gamepad == null)
16+
return;
17+
18+
float leftTrigger = gamepad.leftTrigger.ReadValue();
19+
float rightTrigger = gamepad.rightTrigger.ReadValue();
20+
21+
// Only set motor speeds if haptics were not paused and if trigger is actuated.
22+
// Both triggers must be actuated past 0.2f to start haptics.
23+
if (!hapticsArePaused &&
24+
(gamepad.leftTrigger.IsActuated() || gamepad.rightTrigger.IsActuated()))
25+
gamepad.SetMotorSpeeds(
26+
leftTrigger < 0.2f ? 0.0f : leftTrigger,
27+
rightTrigger < 0.2f ? 0.0f : rightTrigger);
28+
29+
// Toggle haptics "playback" when "Button South" is pressed.
30+
// Notice that if you release the triggers after pausing,
31+
// and press the button again, haptics will resume.
32+
if (gamepad.buttonSouth.wasPressedThisFrame)
33+
{
34+
if (hapticsArePaused)
35+
gamepad.ResumeHaptics();
36+
else
37+
gamepad.PauseHaptics();
38+
39+
hapticsArePaused = !hapticsArePaused;
40+
}
41+
42+
// Notice that if you release the triggers after pausing,
43+
// and press the Start button, haptics will be reset.
44+
if (gamepad.startButton.wasPressedThisFrame)
45+
gamepad.ResetHaptics();
46+
}
47+
}
48+
}

Packages/com.unity.inputsystem/DocCodeSamples.Tests/GamepadHapticsExample.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ internal class AxisCompositeEditor : InputParameterEditor<AxisComposite>
220220
public override void OnGUI()
221221
{
222222
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
223-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
223+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
224224
#endif
225225
target.whichSideWins = (AxisComposite.WhichSideWins)EditorGUILayout.EnumPopup(m_WhichAxisWinsLabel, target.whichSideWins);
226226
}

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ internal class Vector2CompositeEditor : InputParameterEditor<Vector2Composite>
200200
public override void OnGUI()
201201
{
202202
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
203-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
203+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
204204
#endif
205205
target.mode = (Vector2Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode);
206206
}

0 commit comments

Comments
 (0)