Skip to content

Commit d395aa1

Browse files
bmalratstefanunity
andauthored
NEW: Added support for F13 to F24 keys (#2075)
Co-authored-by: Stefan Schubert <stefan@unity3d.com>
1 parent 8bfd742 commit d395aa1

File tree

15 files changed

+762
-92
lines changed

15 files changed

+762
-92
lines changed

Assets/Samples/InGameHints/InGameHintsActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.13.2
4+
// version 1.14.0
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Samples/SimpleDemo/SimpleControls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.13.2
4+
// version 1.14.0
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Tests/InputSystem/APIVerificationTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ public class DualShock4GamepadHID : DualShockGamepad
554554
public int right = 0;
555555
public int up = 0;
556556
")]
557+
// KeyboardState state size has increased to support more keys like F13-F24
558+
[ScopedExclusionProperty("1.0.0", "UnityEngine.InputSystem.LowLevel", "public struct KeyboardState : IInputStateTypeInfo", "public fixed byte keys[14];")]
559+
// Allow Key.IMESelected to be marked as Obsolete
560+
[ScopedExclusionProperty("1.0.0", "UnityEngine.InputSystem", "public enum Key", "IMESelected = 111,")]
557561
public void API_MinorVersionsHaveNoBreakingChanges()
558562
{
559563
var currentVersion = CoreTests.PackageJson.ReadVersion();

Assets/Tests/InputSystem/CorePerformanceTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,13 @@ public void Performance_ReadEveryKey()
123123

124124
Measure.Method(() =>
125125
{
126+
int keyIndex = 0;
126127
foreach (var key in keyboard.allKeys)
128+
{
129+
if (++keyIndex == (int)KeyEx.IMESelected) // Skip IMESelected as it's not a real key.
130+
continue;
127131
key.ReadValue();
132+
}
128133
})
129134
.MeasurementCount(100)
130135
.WarmupCount(5)

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,10 +2674,59 @@ public void Devices_AnyKeyOnKeyboard_DoesNotReactToIMESelected()
26742674
{
26752675
var keyboard = InputSystem.AddDevice<Keyboard>();
26762676

2677-
InputSystem.QueueStateEvent(keyboard, new KeyboardState(Key.IMESelected));
2677+
InputSystem.QueueStateEvent(keyboard, new KeyboardState(IMESelected: true));
26782678
InputSystem.Update();
26792679

26802680
Assert.That(keyboard.anyKey.isPressed, Is.False);
2681+
Assert.That(keyboard.imeSelected.isPressed, Is.True);
2682+
}
2683+
2684+
[Test]
2685+
[Category("Devices")]
2686+
[Obsolete("Test obsolete IMESelected Key")]
2687+
public void Devices_ImeSelectedKeyOnKeyboard_SupportObsoleteIMESelectedKey()
2688+
{
2689+
var keyboard = InputSystem.AddDevice<Keyboard>();
2690+
2691+
InputSystem.QueueStateEvent(keyboard, new KeyboardState(Key.IMESelected));
2692+
InputSystem.Update();
2693+
2694+
Assert.That(keyboard.imeSelected.isPressed, Is.True);
2695+
}
2696+
2697+
[Test]
2698+
[Category("Devices")]
2699+
public void Devices_ImeSelectedKeyOnKeyboard_IsBackwardCompatible()
2700+
{
2701+
var keyboard = InputSystem.AddDevice<Keyboard>();
2702+
2703+
var oldKeyboardStateWithIMESelected = new KeyboardState(Key.None);
2704+
// Hard coded state from previous version that have IMESelected setted
2705+
unsafe
2706+
{
2707+
oldKeyboardStateWithIMESelected.keys[0] = 0;
2708+
oldKeyboardStateWithIMESelected.keys[1] = 0;
2709+
oldKeyboardStateWithIMESelected.keys[2] = 0;
2710+
oldKeyboardStateWithIMESelected.keys[3] = 0;
2711+
oldKeyboardStateWithIMESelected.keys[4] = 0;
2712+
oldKeyboardStateWithIMESelected.keys[5] = 0;
2713+
oldKeyboardStateWithIMESelected.keys[6] = 0;
2714+
oldKeyboardStateWithIMESelected.keys[7] = 0;
2715+
2716+
oldKeyboardStateWithIMESelected.keys[8] = 0;
2717+
oldKeyboardStateWithIMESelected.keys[9] = 0;
2718+
oldKeyboardStateWithIMESelected.keys[10] = 0;
2719+
oldKeyboardStateWithIMESelected.keys[11] = 0;
2720+
oldKeyboardStateWithIMESelected.keys[12] = 0;
2721+
oldKeyboardStateWithIMESelected.keys[13] = 128;
2722+
oldKeyboardStateWithIMESelected.keys[14] = 0;
2723+
oldKeyboardStateWithIMESelected.keys[15] = 0;
2724+
}
2725+
2726+
InputSystem.QueueStateEvent(keyboard, oldKeyboardStateWithIMESelected);
2727+
InputSystem.Update();
2728+
2729+
Assert.That(keyboard.imeSelected.isPressed, Is.True);
26812730
}
26822731

26832732
[Test]

Assets/Tests/InputSystem/InputActionCodeGeneratorActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.13.2
4+
// version 1.14.0
55
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ however, it has to be formatted properly to pass verification tests.
1010

1111
## [Unreleased] - yyyy-mm-dd
1212

13+
### Changed
14+
- Changed enum value `Key.IMESelected` to obsolete which was not a real key. Please use the ButtonControl `imeSelected`.
15+
16+
### Added
17+
- Added support of F13-F24 keys. [UUM-44328](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-44328)
18+
1319
## [1.13.1] - 2025-02-18
1420

1521
### Fixed

Packages/com.unity.inputsystem/InputSystem/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static partial class InputSystem
1616
// Keep this in sync with "Packages/com.unity.inputsystem/package.json".
1717
// NOTE: Unfortunately, System.Version doesn't use semantic versioning so we can't include
1818
// "-preview" suffixes here.
19-
internal const string kAssemblyVersion = "1.13.2";
20-
internal const string kDocUrl = "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.13";
19+
internal const string kAssemblyVersion = "1.14.0";
20+
internal const string kDocUrl = "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14";
2121
}
2222
}

0 commit comments

Comments
 (0)