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 their m_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:
[x] 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.
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: