-
Notifications
You must be signed in to change notification settings - Fork 331
CHANGE: Support entering playmode with Domain Reload disabled ("Faster Enter Playmode") #2343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
K-Tone
wants to merge
36
commits into
develop
Choose a base branch
from
anthony/faster-enter-playmode
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d7fdac4
Implement basic support for FEPM (ISX-1842)
timkeo 7371ea8
Refactor InputManager and tests for cleaner init flows (ISX-1842)
timkeo b1bf0b8
Refactor ProjectWideActions to fix initialization with FEPM (ISX-1840)
timkeo c8efa00
Refactor various InputSystem members to improved separation of concer…
timkeo a58a65a
Fix branch after rebasing with develop (ISX-1840)
timkeo c534e18
Refactor DeferBindingResolution to remove statics (ISX-1840)
timkeo e042a1f
Refactor GlobalState usages to re-initialize statics (ISX-1840)
timkeo d1aba5c
Update Plugin classes to fix static usages (ISX-1840)
timkeo bc2d23e
Misc refactoring to clean up static fields and other small improvemen…
timkeo bef9515
Address InputSystem refactor PR feedback
timkeo 86f3f85
Merge branch 'develop' into isxb-1085-fepm-revisited
ekcoh 2ce3827
Merge branch 'develop' into isxb-1085-fepm-revisited
ekcoh 53c1763
Fixed merge conflicts, exceptions throw during type registration and …
ekcoh b70cea0
Removed obsolete settings restore in analytics tests
ekcoh 4abe485
Merge branch 'develop' into isxb-1085-fepm-revisited
ekcoh a1a4377
Resolved merge conflict
ekcoh bd61d0f
Backport of ISXB-937
ekcoh c25f851
Reverted accidental edits from previous merge
ekcoh 657313e
Added missing statement to InputActionMap
ekcoh 54f072a
Rerun formatter
ekcoh c45b5de
Merge remote-tracking branch 'origin/develop' into anthony/faster-ent…
K-Tone 9081434
fix up a tricky merge confict - define, and non-static through a sing…
K-Tone f9cf9f6
exclude bindings resolution flag in ctors - because they can be calle…
K-Tone e4a452c
project wide actions define has been removed on the main
K-Tone 41128e5
enable actions when initialising editor since we don't do that in ent…
K-Tone bc6dc48
don't reset globals in the domain reload enabled path since it's doub…
K-Tone 7de95b5
Merge remote-tracking branch 'origin/develop' into anthony/faster-ent…
K-Tone 6fad6a0
fixup formatting
K-Tone 55baff2
fixup a possible array clear problem (a review suggestion)
K-Tone 1415877
avoid creating the test manager if its null (a review suggestion)
K-Tone 877bb11
also reset the pair with devices field as per review suggestion
K-Tone b946261
formatting
K-Tone 7cafda8
remove comment that is no longer needed
K-Tone 771979f
used named variables as per review
K-Tone 7932673
used named paramters
K-Tone 2e62b77
remove ancient code that has already been removed on the main branch
K-Tone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,11 +147,11 @@ public void Editor_CanSaveAndRestoreState() | |
| }.ToJson()); | ||
| InputSystem.Update(); | ||
|
|
||
| InputSystem.SaveAndReset(); | ||
| m_StateManager.SaveAndReset(enableRemoting: false, runtime: null); | ||
|
|
||
| Assert.That(InputSystem.devices, Has.Count.EqualTo(0)); | ||
|
|
||
| InputSystem.Restore(); | ||
| m_StateManager.Restore(); | ||
|
|
||
| Assert.That(InputSystem.devices, | ||
| Has.Exactly(1).With.Property("layout").EqualTo("MyDevice").And.TypeOf<Gamepad>()); | ||
|
|
@@ -165,6 +165,7 @@ public void Editor_CanSaveAndRestoreState() | |
| Assert.That(unsupportedDevices[0].interfaceName, Is.EqualTo("Test")); | ||
| } | ||
|
|
||
| #if !ENABLE_CORECLR | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is always false for now and preparing for the future? |
||
| // onFindLayoutForDevice allows dynamically injecting new layouts into the system that | ||
| // are custom-tailored at runtime for the discovered device. Make sure that our domain | ||
| // reload can restore these. | ||
|
|
@@ -195,12 +196,12 @@ public void Editor_DomainReload_CanRestoreDevicesBuiltWithDynamicallyGeneratedLa | |
|
|
||
| Assert.That(InputSystem.devices, Has.Exactly(1).TypeOf<HID>()); | ||
|
|
||
| InputSystem.SaveAndReset(); | ||
| m_StateManager.SaveAndReset(false, null); | ||
|
|
||
| Assert.That(InputSystem.devices, Is.Empty); | ||
|
|
||
| var state = InputSystem.GetSavedState(); | ||
| var manager = InputSystem.s_Manager; | ||
| var state = m_StateManager.GetSavedState(); | ||
| var manager = InputSystem.manager; | ||
|
|
||
| manager.m_SavedAvailableDevices = state.managerState.availableDevices; | ||
| manager.m_SavedDeviceStates = state.managerState.devices; | ||
|
|
@@ -209,7 +210,7 @@ public void Editor_DomainReload_CanRestoreDevicesBuiltWithDynamicallyGeneratedLa | |
|
|
||
| Assert.That(InputSystem.devices, Has.Exactly(1).TypeOf<HID>()); | ||
|
|
||
| InputSystem.Restore(); | ||
| m_StateManager.Restore(); | ||
| } | ||
|
|
||
| [Test] | ||
|
|
@@ -219,7 +220,7 @@ public void Editor_DomainReload_PreservesUsagesOnDevices() | |
| var device = InputSystem.AddDevice<Gamepad>(); | ||
| InputSystem.SetDeviceUsage(device, CommonUsages.LeftHand); | ||
|
|
||
| SimulateDomainReload(); | ||
| InputSystem.TestHook_SimulateDomainReload(runtime); | ||
K-Tone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| var newDevice = InputSystem.devices[0]; | ||
|
|
||
|
|
@@ -239,7 +240,7 @@ public void Editor_DomainReload_PreservesEnabledState() | |
|
|
||
| Assert.That(device.enabled, Is.False); | ||
|
|
||
| SimulateDomainReload(); | ||
| InputSystem.TestHook_SimulateDomainReload(runtime); | ||
|
|
||
| var newDevice = InputSystem.devices[0]; | ||
|
|
||
|
|
@@ -252,7 +253,7 @@ public void Editor_DomainReload_InputSystemInitializationCausesDevicesToBeRecrea | |
| { | ||
| InputSystem.AddDevice<Gamepad>(); | ||
|
|
||
| SimulateDomainReload(); | ||
| InputSystem.TestHook_SimulateDomainReload(runtime); | ||
|
|
||
| Assert.That(InputSystem.devices, Has.Count.EqualTo(1)); | ||
| Assert.That(InputSystem.devices[0], Is.TypeOf<Gamepad>()); | ||
|
|
@@ -289,7 +290,7 @@ public void Editor_DomainReload_CustomDevicesAreRestoredAsLayoutsBecomeAvailable | |
| InputSystem.RegisterLayout(kLayout); | ||
| InputSystem.AddDevice("CustomDevice"); | ||
|
|
||
| SimulateDomainReload(); | ||
| InputSystem.TestHook_SimulateDomainReload(runtime); | ||
|
|
||
| Assert.That(InputSystem.devices, Is.Empty); | ||
|
|
||
|
|
@@ -310,7 +311,7 @@ public void Editor_DomainReload_RetainsUnsupportedDevices() | |
| }); | ||
| InputSystem.Update(); | ||
|
|
||
| SimulateDomainReload(); | ||
| InputSystem.TestHook_SimulateDomainReload(runtime); | ||
|
|
||
| Assert.That(InputSystem.GetUnsupportedDevices(), Has.Count.EqualTo(1)); | ||
| Assert.That(InputSystem.GetUnsupportedDevices()[0].interfaceName, Is.EqualTo("SomethingUnknown")); | ||
|
|
@@ -346,19 +347,21 @@ public void Editor_DomainReload_CanRemoveDevicesDuringDomainReload() | |
| Assert.That(InputSystem.devices[0], Is.AssignableTo<Keyboard>()); | ||
| } | ||
|
|
||
| #endif // !ENABLE_CORECLR | ||
|
|
||
| [Test] | ||
| [Category("Editor")] | ||
| public void Editor_RestoringStateWillCleanUpEventHooks() | ||
| { | ||
| InputSystem.SaveAndReset(); | ||
| m_StateManager.SaveAndReset(false, null); | ||
|
|
||
| var receivedOnEvent = 0; | ||
| var receivedOnDeviceChange = 0; | ||
|
|
||
| InputSystem.onEvent += (e, d) => ++ receivedOnEvent; | ||
| InputSystem.onDeviceChange += (c, d) => ++ receivedOnDeviceChange; | ||
|
|
||
| InputSystem.Restore(); | ||
| m_StateManager.Restore(); | ||
|
|
||
| var device = InputSystem.AddDevice("Gamepad"); | ||
| InputSystem.QueueStateEvent(device, new GamepadState()); | ||
|
|
@@ -375,8 +378,8 @@ public void Editor_RestoringStateWillRestoreObjectsOfLayoutBuilder() | |
| var builder = new TestLayoutBuilder {layoutToLoad = "Gamepad"}; | ||
| InputSystem.RegisterLayoutBuilder(() => builder.DoIt(), "TestLayout"); | ||
|
|
||
| InputSystem.SaveAndReset(); | ||
| InputSystem.Restore(); | ||
| m_StateManager.SaveAndReset(false, null); | ||
| m_StateManager.Restore(); | ||
|
|
||
| var device = InputSystem.AddDevice("TestLayout"); | ||
|
|
||
|
|
@@ -2504,7 +2507,7 @@ public void TODO_Editor_SettingsModifiedInPlayMode_AreRestoredWhenReEnteringEdit | |
| [Category("Editor")] | ||
| public void Editor_AlwaysKeepsEditorUpdatesEnabled() | ||
| { | ||
| Assert.That(InputSystem.s_Manager.updateMask & InputUpdateType.Editor, Is.EqualTo(InputUpdateType.Editor)); | ||
| Assert.That(InputSystem.manager.updateMask & InputUpdateType.Editor, Is.EqualTo(InputUpdateType.Editor)); | ||
| } | ||
|
|
||
| [Test] | ||
|
|
@@ -2961,16 +2964,16 @@ public void Editor_LeavingPlayMode_DestroysAllActionStates() | |
| action.Enable(); | ||
|
|
||
| Assert.That(InputActionState.s_GlobalState.globalList.length, Is.EqualTo(1)); | ||
| Assert.That(InputSystem.s_Manager.m_StateChangeMonitors.Length, Is.GreaterThan(0)); | ||
| Assert.That(InputSystem.s_Manager.m_StateChangeMonitors[0].count, Is.EqualTo(1)); | ||
| Assert.That(InputSystem.manager.m_StateChangeMonitors.Length, Is.GreaterThan(0)); | ||
| Assert.That(InputSystem.manager.m_StateChangeMonitors[0].count, Is.EqualTo(1)); | ||
|
|
||
| // Exit play mode. | ||
| InputSystem.OnPlayModeChange(PlayModeStateChange.ExitingPlayMode); | ||
| InputSystem.OnPlayModeChange(PlayModeStateChange.EnteredEditMode); | ||
|
|
||
| Assert.That(InputActionState.s_GlobalState.globalList.length, Is.Zero); | ||
| // Won't get removed, just cleared. | ||
| Assert.That(InputSystem.s_Manager.m_StateChangeMonitors[0].listeners[0].control, Is.Null); | ||
| Assert.That(InputSystem.manager.m_StateChangeMonitors[0].listeners[0].control, Is.Null); | ||
| } | ||
|
|
||
| [Test] | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.