Skip to content

Commit 6352eb0

Browse files
authored
Merge branch 'develop' into docf-1179-fixedupdate-vs-update
2 parents ed28ae2 + 026cdcc commit 6352eb0

25 files changed

+379
-27
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.11.1
4+
// version 1.11.2
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.11.1
4+
// version 1.11.2
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/CoreTests_Analytics.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,55 @@ public void Analytics_ShouldReportPlayerInputManagerData()
663663
}
664664
}
665665

666+
[Test]
667+
[Category("Analytics")]
668+
public void Analytics_ShouldReportCodeAuthoringAnalytic()
669+
{
670+
CollectAnalytics(InputExitPlayModeAnalytic.kEventName);
671+
672+
// NOTE: We do not want to trigger entering/exiting play-mode for this small data-sanity check
673+
// so just stick to triggering it explicitly. A better test would have been an editor test
674+
// going in and out of play-mode for real but not clear if this is really possible.
675+
676+
// Pretend we are entering play-mode
677+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.ExitingEditMode);
678+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.EnteredPlayMode);
679+
680+
// Assert no data received
681+
Assert.That(sentAnalyticsEvents.Count, Is.EqualTo(0));
682+
683+
// Pretend we are exiting play-mode
684+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.ExitingPlayMode);
685+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.EnteredEditMode);
686+
687+
// Assert: Data received
688+
Assert.That(sentAnalyticsEvents.Count, Is.EqualTo(1));
689+
Assert.That(sentAnalyticsEvents[0].name, Is.EqualTo(InputExitPlayModeAnalytic.kEventName));
690+
Assert.That(sentAnalyticsEvents[0].data, Is.TypeOf<InputExitPlayModeAnalytic.Data>());
691+
692+
var data0 = (InputExitPlayModeAnalytic.Data)sentAnalyticsEvents[0].data;
693+
Assert.That(data0.uses_code_authoring, Is.False);
694+
695+
// Pretend we are entering play-mode
696+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.ExitingEditMode);
697+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.EnteredPlayMode);
698+
699+
var action = new InputAction("Dance");
700+
action.AddBinding("<Keyboard>/Space");
701+
702+
// Pretend we are exiting play-mode
703+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.ExitingPlayMode);
704+
InputExitPlayModeAnalytic.OnPlayModeStateChange(PlayModeStateChange.EnteredEditMode);
705+
706+
// Assert: Data received
707+
Assert.That(sentAnalyticsEvents.Count, Is.EqualTo(2));
708+
Assert.That(sentAnalyticsEvents[1].name, Is.EqualTo(InputExitPlayModeAnalytic.kEventName));
709+
Assert.That(sentAnalyticsEvents[1].data, Is.TypeOf<InputExitPlayModeAnalytic.Data>());
710+
711+
var data1 = (InputExitPlayModeAnalytic.Data)sentAnalyticsEvents[1].data;
712+
Assert.That(data1.uses_code_authoring, Is.True);
713+
}
714+
666715
#if UNITY_INPUT_SYSTEM_ENABLE_UI
667716
[Test]
668717
[Category("Analytics")]

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.11.1
4+
// version 1.11.2
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ however, it has to be formatted properly to pass verification tests.
1010

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

13+
## [1.11.1] - 2024-09-26
14+
1315
### Fixed
1416
- Fixed Multiple interactions could breaks on Composite Binding. [ISXB-619](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-619)
1517
- Fixed memory leak when the OnScreenStick component was destroyed [ISXB-1070](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1070). Contribution by [LukeUnityDev](https://github.com/LukeUnityDev).
@@ -45,6 +47,7 @@ however, it has to be formatted properly to pass verification tests.
4547
- Added tests for Input Action Editor UI for managing action maps (List, create, rename, delete) (ISX-2087)
4648
- Added automatic loading of custom extensions of InputProcessor, InputInteraction and InputBindingComposite [ISXB-856]](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-856).
4749
- Added an IME Input sample scene.
50+
- Added analytics for programmatic `InputAction` setup via `InputActionSetupExtensions`.
4851

4952
## [1.10.0] - 2024-07-24
5053

Packages/com.unity.inputsystem/InputSystem/Actions/InputActionSetupExtensions.cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,23 @@ public static BindingSyntax AddBinding(this InputAction action, string path, str
306306
});
307307
}
308308

309+
/// <summary>
310+
/// Conditionally compiled helper for logging API usage of code-authored actions.
311+
/// </summary>
312+
/// <param name="api">The associated API function.</param>
313+
/// <remarks>
314+
/// Be extremely carefully to review for indirect calls and overloads to not register analytics twice.
315+
/// Be extremely careful in enabling/disabling tracking before internal calls since those may otherwise
316+
/// be incorrectly registered.
317+
/// </remarks>
318+
#if UNITY_EDITOR
319+
private static void RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api api)
320+
{
321+
UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Register(api);
322+
}
323+
324+
#endif
325+
309326
/// <summary>
310327
/// Add a binding that references the given <paramref name="control"/> and triggers
311328
/// the given <paramref cref="action"/>.
@@ -349,6 +366,10 @@ public static BindingSyntax AddBinding(this InputAction action, InputControl con
349366
/// </remarks>
350367
public static BindingSyntax AddBinding(this InputAction action, InputBinding binding = default)
351368
{
369+
#if UNITY_EDITOR
370+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.AddBinding);
371+
#endif
372+
352373
if (action == null)
353374
throw new ArgumentNullException(nameof(action));
354375

@@ -478,6 +499,10 @@ public static BindingSyntax AddBinding(this InputActionMap actionMap, string pat
478499
/// <seealso cref="InputActionMap.bindings"/>
479500
public static BindingSyntax AddBinding(this InputActionMap actionMap, InputBinding binding)
480501
{
502+
#if UNITY_EDITOR
503+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.AddBinding);
504+
#endif
505+
481506
if (actionMap == null)
482507
throw new ArgumentNullException(nameof(actionMap));
483508
if (binding.path == null)
@@ -501,6 +526,10 @@ public static BindingSyntax AddBinding(this InputActionMap actionMap, InputBindi
501526
public static CompositeSyntax AddCompositeBinding(this InputAction action, string composite,
502527
string interactions = null, string processors = null)
503528
{
529+
#if UNITY_EDITOR
530+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.AddCompositeBinding);
531+
#endif
532+
504533
if (action == null)
505534
throw new ArgumentNullException(nameof(action));
506535
if (string.IsNullOrEmpty(composite))
@@ -580,6 +609,10 @@ private static int AddBindingInternal(InputActionMap map, InputBinding binding,
580609
/// of <paramref name="action"/>).</exception>
581610
public static BindingSyntax ChangeBinding(this InputAction action, int index)
582611
{
612+
#if UNITY_EDITOR
613+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ChangeBinding);
614+
#endif
615+
583616
if (action == null)
584617
throw new ArgumentNullException(nameof(action));
585618

@@ -638,6 +671,10 @@ public static BindingSyntax ChangeBinding(this InputAction action, string name)
638671
/// of <paramref name="actionMap"/>).</exception>
639672
public static BindingSyntax ChangeBinding(this InputActionMap actionMap, int index)
640673
{
674+
#if UNITY_EDITOR
675+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ChangeBinding);
676+
#endif
677+
641678
if (actionMap == null)
642679
throw new ArgumentNullException(nameof(actionMap));
643680
if (index < 0 || index >= actionMap.m_Bindings.LengthSafe())
@@ -836,6 +873,10 @@ public static BindingSyntax ChangeBinding(this InputAction action, InputBinding
836873
/// <seealso cref="InputBindingComposite"/>
837874
public static BindingSyntax ChangeCompositeBinding(this InputAction action, string compositeName)
838875
{
876+
#if UNITY_EDITOR
877+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ChangeCompositeBinding);
878+
#endif
879+
839880
if (action == null)
840881
throw new ArgumentNullException(nameof(action));
841882
if (string.IsNullOrEmpty(compositeName))
@@ -877,6 +918,10 @@ public static BindingSyntax ChangeCompositeBinding(this InputAction action, stri
877918
/// </remarks>
878919
public static void Rename(this InputAction action, string newName)
879920
{
921+
#if UNITY_EDITOR
922+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.Rename);
923+
#endif
924+
880925
if (action == null)
881926
throw new ArgumentNullException(nameof(action));
882927
if (string.IsNullOrEmpty(newName))
@@ -919,6 +964,10 @@ public static void Rename(this InputAction action, string newName)
919964
/// </remarks>
920965
public static void AddControlScheme(this InputActionAsset asset, InputControlScheme controlScheme)
921966
{
967+
#if UNITY_EDITOR
968+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.AddControlScheme);
969+
#endif
970+
922971
if (asset == null)
923972
throw new ArgumentNullException(nameof(asset));
924973
if (string.IsNullOrEmpty(controlScheme.name))
@@ -987,6 +1036,10 @@ public static ControlSchemeSyntax AddControlScheme(this InputActionAsset asset,
9871036
/// </remarks>
9881037
public static void RemoveControlScheme(this InputActionAsset asset, string name)
9891038
{
1039+
#if UNITY_EDITOR
1040+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.RemoveControlScheme);
1041+
#endif
1042+
9901043
if (asset == null)
9911044
throw new ArgumentNullException(nameof(asset));
9921045
if (string.IsNullOrEmpty(name))
@@ -1007,33 +1060,57 @@ public static void RemoveControlScheme(this InputActionAsset asset, string name)
10071060
/// <returns><paramref name="scheme"/></returns>
10081061
public static InputControlScheme WithBindingGroup(this InputControlScheme scheme, string bindingGroup)
10091062
{
1063+
#if UNITY_EDITOR
1064+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ControlSchemeWithBindingGroup);
1065+
#endif
1066+
10101067
return new ControlSchemeSyntax(scheme).WithBindingGroup(bindingGroup).Done();
10111068
}
10121069

10131070
public static InputControlScheme WithDevice(this InputControlScheme scheme, string controlPath, bool required)
10141071
{
1072+
#if UNITY_EDITOR
1073+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ControlSchemeWithDevice);
1074+
#endif
1075+
10151076
if (required)
10161077
return new ControlSchemeSyntax(scheme).WithRequiredDevice(controlPath).Done();
10171078
return new ControlSchemeSyntax(scheme).WithOptionalDevice(controlPath).Done();
10181079
}
10191080

10201081
public static InputControlScheme WithRequiredDevice(this InputControlScheme scheme, string controlPath)
10211082
{
1083+
#if UNITY_EDITOR
1084+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ControlSchemeWithRequiredDevice);
1085+
#endif
1086+
10221087
return new ControlSchemeSyntax(scheme).WithRequiredDevice(controlPath).Done();
10231088
}
10241089

10251090
public static InputControlScheme WithOptionalDevice(this InputControlScheme scheme, string controlPath)
10261091
{
1092+
#if UNITY_EDITOR
1093+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ControlSchemeWithOptionalDevice);
1094+
#endif
1095+
10271096
return new ControlSchemeSyntax(scheme).WithOptionalDevice(controlPath).Done();
10281097
}
10291098

10301099
public static InputControlScheme OrWithRequiredDevice(this InputControlScheme scheme, string controlPath)
10311100
{
1101+
#if UNITY_EDITOR
1102+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ControlSchemeOrWithRequiredDevice);
1103+
#endif
1104+
10321105
return new ControlSchemeSyntax(scheme).OrWithRequiredDevice(controlPath).Done();
10331106
}
10341107

10351108
public static InputControlScheme OrWithOptionalDevice(this InputControlScheme scheme, string controlPath)
10361109
{
1110+
#if UNITY_EDITOR
1111+
RegisterApiUsage(UnityEngine.InputSystem.Editor.InputExitPlayModeAnalytic.Api.ControlSchemeOrWithOptionalDevice);
1112+
#endif
1113+
10371114
return new ControlSchemeSyntax(scheme).OrWithOptionalDevice(controlPath).Done();
10381115
}
10391116

Packages/com.unity.inputsystem/InputSystem/Actions/InputInteractionContext.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public bool ControlIsActuated(float threshold = 0)
123123
/// Mark the interaction has having begun.
124124
/// </summary>
125125
/// <remarks>
126-
/// Note that this affects the current interaction only. There may be multiple interactions on a binding
127-
/// and arbitrary many interactions may concurrently be in started state. However, only one interaction
126+
/// This affects the current interaction only. There might be multiple interactions on a binding
127+
/// and arbitrary many interactions might concurrently be in started state. However, only one interaction
128128
/// (usually the one that starts first) is allowed to drive the action's state as a whole. If an interaction
129129
/// that is currently driving an action is canceled, however, the next interaction in the list that has
130130
/// been started will take over and continue driving the action.
@@ -161,13 +161,31 @@ public void Started()
161161
m_State.ChangePhaseOfInteraction(InputActionPhase.Started, ref m_TriggerState);
162162
}
163163

164+
/// <summary>
165+
/// Marks the interaction as being performed and then transitions back to <see cref="InputActionPhase.Waiting"/>
166+
/// to wait for input. This behavior is desirable for interaction events that are instant and reflect
167+
/// a transitional interaction pattern such as <see cref="Interactions.PressInteraction"/> or <see cref="Interactions.TapInteraction"/>.
168+
/// </summary>
169+
/// <remarks>
170+
/// Note that this affects the current interaction only. There might be multiple interactions on a binding
171+
/// and arbitrary many interactions might concurrently be in started state. However, only one interaction
172+
/// (usually the one that starts first) is allowed to drive the action's state as a whole. If an interaction
173+
/// that is currently driving an action is canceled, however, the next interaction in the list that has
174+
/// been started will take over and continue driving the action.
175+
/// </remarks>
164176
public void Performed()
165177
{
166178
if (m_TriggerState.phase == InputActionPhase.Waiting)
167179
m_TriggerState.startTime = time;
168180
m_State.ChangePhaseOfInteraction(InputActionPhase.Performed, ref m_TriggerState);
169181
}
170182

183+
/// <summary>
184+
/// Marks the interaction as being performed and then transitions into I <see cref="InputActionPhase.Started"/>
185+
/// to wait for an initial trigger condition to be true before being performed again. This behavior
186+
/// may be desirable for interaction events that reflect transitional interaction patterns but should
187+
/// be considered as started until a cancellation condition is true, such as releasing a button.
188+
/// </summary>
171189
public void PerformedAndStayStarted()
172190
{
173191
if (m_TriggerState.phase == InputActionPhase.Waiting)
@@ -176,6 +194,12 @@ public void PerformedAndStayStarted()
176194
phaseAfterPerformed: InputActionPhase.Started);
177195
}
178196

197+
/// <summary>
198+
/// Marks the interaction as being performed and then stays in that state waiting for an input to
199+
/// cancel the interactions active state. This behavior is desirable for interaction events that
200+
/// are active for a duration until a cancellation condition is true, such as <see cref="Interactions.HoldInteraction"/> or <see cref="Interactions.TapInteraction"/> where releasing
201+
/// the associated button cancels the interaction..
202+
/// </summary>
179203
public void PerformedAndStayPerformed()
180204
{
181205
if (m_TriggerState.phase == InputActionPhase.Waiting)
@@ -184,6 +208,16 @@ public void PerformedAndStayPerformed()
184208
phaseAfterPerformed: InputActionPhase.Performed);
185209
}
186210

211+
/// <summary>
212+
/// Marks the interaction as being interrupted or aborted. This is relevant to signal that the interaction
213+
/// pattern was not completed, for example, the user pressed and then released a button before the minimum
214+
/// time required for a <see cref="Interactions.HoldInteraction"/> to complete.
215+
/// </summary>
216+
/// <remarks>
217+
/// This is used by most existing interactions to cancel the transitions in the interaction state machine
218+
/// when a condition required to proceed turned false or other indirect requirements were not met, such as
219+
/// time-based conditions.
220+
/// </remarks>
187221
public void Canceled()
188222
{
189223
if (m_TriggerState.phase != InputActionPhase.Canceled)

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

Lines changed: 1 addition & 1 deletion
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.11.1";
19+
internal const string kAssemblyVersion = "1.11.2";
2020
internal const string kDocUrl = "https://docs.unity3d.com/Packages/[email protected]";
2121
}
2222
}

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastKeyboard.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:InputLayoutCodeGenerator
4-
// version 1.11.1
4+
// version 1.11.2
55
// from "Keyboard" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastMouse.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:InputLayoutCodeGenerator
4-
// version 1.11.1
4+
// version 1.11.2
55
// from "Mouse" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

0 commit comments

Comments
 (0)