FIX: InputActionReference when using FEPM (ISX-1968) #1949
Merged
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.
Description
When Domain Reloads are disabled, InputActionReference instances continue to reference the "old" InputAction object from the previous PlayMode session. This fix clears the InputAction reference when exiting PlayMode allowing it to be reloaded in the next session.
Although Configurable PlayMode options, aka Fast Enter PlayMode, isn't currently supported, a number of tickets have been filed against this issue including:
indicating FEPM is quite a popular feature and fixing this issue is beneficial to our customers.
Furthermore, the underlying problem is a bug in its own right regardless of FEPM: the underlying Action instance is invalid for EditMode and holding the reference is dangerous as it keeps the object "alive" along with the pointers to native memory buffers that are de-allocated when exiting PlayMode. In short, attempting to access the ActionReference after leaving PlayMode can cause an AV and crash the Editor.
Changes made
When exiting PlayMode, all
InputActionReference
instances are queried and theirm_Action
field is reset. This forces a "reload" of the Action from the Asset the next time its accessed just as if a Domain Reload had occured.Notes
This issue is completely separate from my CoreCLR refactor and can be fixed independently of it.
Checklist
Before review:
Changed
,Fixed
,Added
sections.([case %number%](https://issuetracker.unity3d.com/issues/...))
.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: