Skip to content

Commit

Permalink
Merge branch 'develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ekcoh authored Jun 26, 2024
2 parents f8a9618 + f9d7240 commit 3155247
Show file tree
Hide file tree
Showing 28 changed files with 251 additions and 135 deletions.
12 changes: 8 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ _Please fill this section with a description what the pull request is trying to

_Please write down a short description of what changes were made._

### Notes
### Testing

_Please write down any additional notes, remove the section if not applicable._
_Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA._

### Risk

_Please describe the potential risks of your changes for the reviewers._

### Checklist

Expand All @@ -17,8 +21,8 @@ Before review:
- [ ] Changelog entry added.
- Explains the change in `Changed`, `Fixed`, `Added` sections.
- For API change contains an example snippet and/or migration example.
- FogBugz ticket attached, example `([case %number%](https://issuetracker.unity3d.com/issues/...))`.
- FogBugz is marked as "Resolved" with *next* release version correctly set.
- JIRA ticket linked, example ([case %<ID>%](https://issuetracker.unity3d.com/product/unity/issues/guid/<ID>)). If it is a private issue, just add the case ID without a link.
- Jira port for the next release set as "Resolved".
- [ ] Tests added/changed, if applicable.
- Functional tests `Area_CanDoX`, `Area_CanDoX_EvenIfYIsTheCase`, `Area_WhenIDoX_AndYHappens_ThisIsTheResult`.
- Performance tests.
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.8.3
// version 1.9.0
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/SimpleDemo/SimpleControls.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.8.3
// version 1.9.0
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
4 changes: 2 additions & 2 deletions Assets/Tests/InputSystem/CorePerformanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -828,15 +828,15 @@ public void Performance_OptimizedControls_EvaluateStaleControlReadsWhenGamepadSt
#endif
return;

void MethodToMeasure(Gamepad gamepad)
void MethodToMeasure(Gamepad g)
{
var value2d = Vector2.zero;

for (var i = 0; i < 1000; ++i)
{
// Make sure state changes are different from previous state so that we mark the controls as
// stale.
InputSystem.QueueStateEvent(gamepad,
InputSystem.QueueStateEvent(g,
new GamepadState
{
leftStick = new Vector2(i / 1000f, i / 1000f),
Expand Down
28 changes: 28 additions & 0 deletions Assets/Tests/InputSystem/CoreTests_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,34 @@
// in terms of complexity.
partial class CoreTests
{
// ISXB-925: Feature flag values should live with containing settings instance.
[TestCase(InputFeatureNames.kUseReadValueCaching)]
[TestCase(InputFeatureNames.kUseOptimizedControls)]
[TestCase(InputFeatureNames.kParanoidReadValueCachingChecks)]
[TestCase(InputFeatureNames.kDisableUnityRemoteSupport)]
[TestCase(InputFeatureNames.kRunPlayerUpdatesInEditMode)]
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
[TestCase(InputFeatureNames.kUseIMGUIEditorForAssets)]
#endif
public void Settings_ShouldStoreSettingsAndFeatureFlags(string featureName)
{
using (var settings = Scoped.Object(InputSettings.CreateInstance<InputSettings>()))
{
InputSystem.settings = settings.value;

Assert.That(InputSystem.settings.IsFeatureEnabled(featureName), Is.False);
settings.value.SetInternalFeatureFlag(featureName, true);
Assert.That(InputSystem.settings.IsFeatureEnabled(featureName), Is.True);

using (var other = Scoped.Object(InputSettings.CreateInstance<InputSettings>()))
{
InputSystem.settings = other.value;

Assert.That(InputSystem.settings.IsFeatureEnabled(featureName), Is.False);
}
}
}

[Test]
[Category("Actions")]
public void Actions_WhenShortcutsDisabled_AllConflictingActionsTrigger()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.8.3
// version 1.9.0
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
19 changes: 19 additions & 0 deletions Assets/Tests/InputSystem/Plugins/DualShockTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,25 @@ public void Devices_SupportsDualShockAsHID_WithJustPIDAndVID(int vendorId, int p
Assert.That(device, Is.AssignableTo<DualShockGamepad>());
}

[Test]
[Category("Devices")]
[TestCase(0x54C, 0xCE6)]
[TestCase(0x54C, 0xDF2)] //Dualsense Edge
public void Devices_SupportsDualsenseAsHID_WithJustPIDAndVID(int vendorId, int productId)
{
var device = InputSystem.AddDevice(new InputDeviceDescription
{
interfaceName = "HID",
capabilities = new HID.HIDDeviceDescriptor
{
vendorId = vendorId,
productId = productId,
}.ToJson()
});

Assert.That(device, Is.AssignableTo<DualSenseGamepadHID>());
}

#if UNITY_WSA
[Test]
[Category("Devices")]
Expand Down
15 changes: 14 additions & 1 deletion Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ however, it has to be formatted properly to pass verification tests.

## [Unreleased] - yyyy-mm-dd

### Change
- Added warning messages to both `OnScreenStick` and `OnScreenButton` Inspector editors that would display a warning message in case on-screen control components are added to a `GameObject` not part of a valid UI hierarchy.
- Changed behavior for internal feature flag relating to Windows Gaming Input to be ignored on non-supported platforms.

### Fixed
- Avoid potential crashes from `NullReferenceException` in `FireStateChangeNotifications`.
- Fixed an issue where a composite binding would not be consecutively triggered after ResetDevice() has been called from the associated action handler [ISXB-746](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-746).
Expand All @@ -19,12 +23,21 @@ however, it has to be formatted properly to pass verification tests.
- Fixed error thrown when Cancelling Control Scheme creation in Input Actions Editor.
- Fixed Scheme Name in Control Scheme editor menu that gets reset when editing devices [ISXB-763](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-763).
- Fixed an issue where `InputActionAsset.FindAction(string, bool)` would throw `System.NullReferenceException` instead of returning `null` if searching for a non-existent action with an explicit action path and using `throwIfNotFound: false`, e.g. searching for "Map/Action" when `InputActionMap` "Map" exists but no `InputAction` named "Action" exists within that map [ISXB-895](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-895).
- Fixed an issue where adding a `OnScreenButton` or `OnScreenStick` to a regular GameObject would lead to exception in editor.
- Fixed an issue where adding a `OnScreenStick` to a regular GameObject and entering play-mode would lead to exceptions being generated.
- Fixed InputActionReference issues when domain reloads are disabled [ISXB-601](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-601), [ISXB-718](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-718), [ISXB-900](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-900)
- Fixed a performance issue with many objects using multiple action maps [ISXB-573](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-573).
- Fixed an variable scope shadowing issue causing compilation to fail on Unity 2019 LTS.
- Fixed an issue where changing `InputSettings` instance would not affect associated feature flags.

## Added
### Added
- Added additional device information when logging the error due to exceeding the maximum number of events processed
set by `InputSystem.settings.maxEventsBytesPerUpdate`. This additional information is available in development builds
only.

### Changed
- Changed `DualSenseHIDInputReport` from internal to public visibility

## [1.8.2] - 2024-04-29

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public event Action<InputAction.CallbackContext> actionTriggered
/// </summary>
public InputActionMap()
{
s_NeedToResolveBindings = true;
}

/// <summary>
Expand Down Expand Up @@ -810,6 +811,7 @@ private enum Flags
}

internal static int s_DeferBindingResolution;
internal static bool s_NeedToResolveBindings;

internal struct DeviceArray
{
Expand Down Expand Up @@ -1193,6 +1195,9 @@ internal bool LazyResolveBindings(bool fullResolve)
m_ControlsForEachAction = null;
controlsForEachActionInitialized = false;

// Indicate that there is at least one action map that has a change
s_NeedToResolveBindings = true;

// If we haven't had to resolve bindings yet, we can wait until when we
// actually have to.
if (m_State == null)
Expand Down Expand Up @@ -1982,6 +1987,9 @@ public void OnBeforeSerialize()
/// </summary>
public void OnAfterDeserialize()
{
// Indicate that there is at least one action map that has a change
s_NeedToResolveBindings = true;

m_State = null;
m_MapIndexInState = InputActionState.kInvalidIndex;
m_EnabledActionsCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,24 @@ public static InputActionReference Create(InputAction action)
return reference;
}

/// <summary>
/// Clears the cached <see cref="m_Action"/> field for all current <see cref="InputActionReference"/> objects.
/// </summary>
/// <remarks>
/// After calling this, the next call to <see cref="action"/> will retrieve a new <see cref="InputAction"/> reference from the existing <see cref="InputActionAsset"/> just as if
/// using it for the first time. The serialized <see cref="m_Asset"/> and <see cref="m_ActionId"/> fields are not touched and will continue to hold their current values.
///
/// This method is used to clear the Action references when exiting PlayMode since those objects are no longer valid.
/// </remarks>
internal static void ResetCachedAction()
{
var allActionRefs = Resources.FindObjectsOfTypeAll(typeof(InputActionReference));
foreach (InputActionReference obj in allActionRefs)
{
obj.m_Action = null;
}
}

[SerializeField] internal InputActionAsset m_Asset;
// Can't serialize System.Guid and Unity's GUID is editor only so these
// go out as strings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4491,23 +4491,27 @@ internal static void DeferredResolutionOfBindings()
++InputActionMap.s_DeferBindingResolution;
try
{
for (var i = 0; i < s_GlobalState.globalList.length; ++i)
if (InputActionMap.s_NeedToResolveBindings)
{
var handle = s_GlobalState.globalList[i];

var state = handle.IsAllocated ? (InputActionState)handle.Target : null;
if (state == null)
for (var i = 0; i < s_GlobalState.globalList.length; ++i)
{
// Stale entry in the list. State has already been reclaimed by GC. Remove it.
if (handle.IsAllocated)
s_GlobalState.globalList[i].Free();
s_GlobalState.globalList.RemoveAtWithCapacity(i);
--i;
continue;
}
var handle = s_GlobalState.globalList[i];

for (var n = 0; n < state.totalMapCount; ++n)
state.maps[n].ResolveBindingsIfNecessary();
var state = handle.IsAllocated ? (InputActionState)handle.Target : null;
if (state == null)
{
// Stale entry in the list. State has already been reclaimed by GC. Remove it.
if (handle.IsAllocated)
s_GlobalState.globalList[i].Free();
s_GlobalState.globalList.RemoveAtWithCapacity(i);
--i;
continue;
}

for (var n = 0; n < state.totalMapCount; ++n)
state.maps[n].ResolveBindingsIfNecessary();
}
InputActionMap.s_NeedToResolveBindings = false;
}
}
finally
Expand Down
4 changes: 2 additions & 2 deletions Packages/com.unity.inputsystem/InputSystem/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static partial class InputSystem
// Keep this in sync with "Packages/com.unity.inputsystem/package.json".
// NOTE: Unfortunately, System.Version doesn't use semantic versioning so we can't include
// "-preview" suffixes here.
internal const string kAssemblyVersion = "1.8.3";
internal const string kDocUrl = "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.8";
internal const string kAssemblyVersion = "1.9.0";
internal const string kDocUrl = "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.9";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ public void ApplyParameterChanges()
private void SetOptimizedControlDataType()
{
// setting check need to be inline so we clear optimizations if setting is disabled after the fact
m_OptimizedControlDataType = InputSettings.optimizedControlsFeatureEnabled
m_OptimizedControlDataType = InputSystem.s_Manager.optimizedControlsFeatureEnabled
? CalculateOptimizedControlDataType()
: (FourCC)InputStateBlock.kFormatInvalid;
}
Expand Down Expand Up @@ -957,7 +957,7 @@ internal void SetOptimizedControlDataTypeRecursively()
[Conditional("UNITY_EDITOR")]
internal void EnsureOptimizationTypeHasNotChanged()
{
if (!InputSettings.optimizedControlsFeatureEnabled)
if (!InputSystem.s_Manager.optimizedControlsFeatureEnabled)
return;

var currentOptimizedControlDataType = CalculateOptimizedControlDataType();
Expand Down Expand Up @@ -1172,7 +1172,7 @@ public ref readonly TValue value

if (
// if feature is disabled we re-evaluate every call
!InputSettings.readValueCachingFeatureEnabled
!InputSystem.s_Manager.readValueCachingFeatureEnabled
// if cached value is stale we re-evaluate and clear the flag
|| m_CachedValueIsStale
// if a processor in stack needs to be re-evaluated, but unprocessedValue is still can be cached
Expand All @@ -1183,7 +1183,7 @@ public ref readonly TValue value
m_CachedValueIsStale = false;
}
#if DEBUG
else if (InputSettings.paranoidReadValueCachingChecksEnabled)
else if (InputSystem.s_Manager.paranoidReadValueCachingChecksEnabled)
{
var oldUnprocessedValue = m_UnprocessedCachedValue;
var newUnprocessedValue = unprocessedValue;
Expand Down Expand Up @@ -1225,7 +1225,7 @@ internal unsafe ref readonly TValue unprocessedValue

if (
// if feature is disabled we re-evaluate every call
!InputSettings.readValueCachingFeatureEnabled
!InputSystem.s_Manager.readValueCachingFeatureEnabled
// if cached value is stale we re-evaluate and clear the flag
|| m_UnprocessedCachedValueIsStale
)
Expand All @@ -1234,7 +1234,7 @@ internal unsafe ref readonly TValue unprocessedValue
m_UnprocessedCachedValueIsStale = false;
}
#if DEBUG
else if (InputSettings.paranoidReadValueCachingChecksEnabled)
else if (InputSystem.s_Manager.paranoidReadValueCachingChecksEnabled)
{
var currentUnprocessedValue = ReadUnprocessedValueFromState(currentStatePtr);
if (CompareValue(ref currentUnprocessedValue, ref m_UnprocessedCachedValue))
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
// version 1.8.3
// version 1.9.0
// from "Keyboard" layout
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
Loading

0 comments on commit 3155247

Please sign in to comment.