Skip to content

Commit 78843dd

Browse files
authored
FIX: Fixing upgrading issues when upgrading from <=1.1.0-pre.5 (#1399)
1 parent c5b2457 commit 78843dd

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
Due to package verification, the latest version below is the unpublished version and the date is meaningless.
99
however, it has to be formatted properly to pass verification tests.
1010

11+
## [Unreleased]
12+
13+
### Fixed
14+
15+
- Fixed `InvalidCastException: Specified cast is not valid.` and `InvalidOperationException: Already have an event buffer set! Was OnUpdate() called recursively?` when upgrading from 1.1.0-pre.5 or earlier. If you experience this issue you can also restart the editor to resolve it.
16+
- Fixed `InputDeviceChange.Destroyed` not being available, now it's correctly marked as obsolete instead.
17+
1118
## [1.1.0] - 2021-08-27
1219

1320
### Changed

Packages/com.unity.inputsystem/InputSystem/Devices/InputDevice.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,16 +619,16 @@ internal enum DeviceFlags
619619

620620
HasStateCallbacks = 1 << 1,
621621
HasControlsWithDefaultState = 1 << 2,
622-
HasDontResetControls = 1 << 3,
623-
HasEventMerger = 1 << 4,
622+
HasDontResetControls = 1 << 10,
623+
HasEventMerger = 1 << 13,
624624

625-
Remote = 1 << 5, // It's a local mirror of a device from a remote player connection.
626-
Native = 1 << 6, // It's a device created from data surfaced by NativeInputRuntime.
625+
Remote = 1 << 3, // It's a local mirror of a device from a remote player connection.
626+
Native = 1 << 4, // It's a device created from data surfaced by NativeInputRuntime.
627627

628-
DisabledInFrontend = 1 << 7, // Explicitly disabled on the managed side.
629-
DisabledInRuntime = 1 << 8, // Disabled in the native runtime.
630-
DisabledWhileInBackground = 1 << 9, // Disabled while the player is running in the background.
631-
DisabledStateHasBeenQueriedFromRuntime = 1 << 10, // Whether we have fetched the current enable/disable state from the runtime.
628+
DisabledInFrontend = 1 << 5, // Explicitly disabled on the managed side.
629+
DisabledInRuntime = 1 << 7, // Disabled in the native runtime.
630+
DisabledWhileInBackground = 1 << 8, // Disabled while the player is running in the background.
631+
DisabledStateHasBeenQueriedFromRuntime = 1 << 6, // Whether we have fetched the current enable/disable state from the runtime.
632632

633633
CanRunInBackground = 1 << 11,
634634
CanRunInBackgroundHasBeenQueried = 1 << 12,

Packages/com.unity.inputsystem/InputSystem/Devices/InputDeviceChange.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using UnityEngine.InputSystem.LowLevel;
23
using UnityEngine.InputSystem.Utilities;
34

@@ -119,5 +120,8 @@ public enum InputDeviceChange
119120
/// This notification is sent before the actual reset happens.
120121
/// </summary>
121122
HardReset,
123+
124+
[Obsolete("Destroyed enum has been deprecated.")]
125+
Destroyed,
122126
}
123127
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3114,7 +3114,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
31143114
// carries crucial entropy (button changed state, phase changed, counter changed, etc).
31153115
// Hence semantic meaning for current event is "can't merge current with next because next is different".
31163116
// But semantic meaning for next event is "next event carries important information and should be preserved",
3117-
// from that point of few next event should not be merged with current nor with _next after next_ event.
3117+
// from that point of view next event should not be merged with current nor with _next after next_ event.
31183118
//
31193119
// For example, given such stream of events:
31203120
// Mouse Mouse Mouse Mouse Mouse Mouse Mouse
@@ -3724,6 +3724,11 @@ public void Restore(InputDevice device)
37243724
/// Most of the state we re-recreate in-between reloads and do not store
37253725
/// in this structure. In particular, we do not preserve anything from
37263726
/// the various RegisterXXX().
3727+
///
3728+
/// WARNING
3729+
///
3730+
/// Making changes to serialized data format will likely to break upgrading projects from older versions.
3731+
/// That is until you restart the editor, then we recreate everything from clean state.
37273732
/// </remarks>
37283733
[Serializable]
37293734
internal struct SerializedState

0 commit comments

Comments
 (0)