File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Packages/com.unity.inputsystem/InputSystem/Actions Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,16 @@ public InputAction action
52
52
{
53
53
get
54
54
{
55
- // Note that we check m_Action since it would be null if we haven't yet resolved the action.
56
- // We also need to check that m_Action.actionMap isn't null since it would be null if the
57
- // action was deleted. Additionally we need to check m_Asset since it could also have been deleted.
58
- if ( m_Action != null && m_Action . actionMap != null && m_Asset )
55
+ // Note that we need to check multiple things here that could invalidate the validity of the reference:
56
+ // 1) m_Action != null, this indicates if we have a resolved cached reference.
57
+ // 2) m_Action.actionMap != null, this would fail if the action has been removed from an action map
58
+ // and converted into a "singleton action". This would render the reference invalid since the action
59
+ // is no longer indirectly bound to m_Asset.
60
+ // 3) m_Action.actionMap.asset == m_Asset, needs to be checked to make sure that its action map
61
+ // have not been moved to another asset which would invalidate the reference since reference is
62
+ // defined by action GUID and asset reference.
63
+ // 4) m_Asset, a Unity object life-time check that would fail if the asset has been deleted.
64
+ if ( m_Action != null && m_Action . actionMap != null && m_Action . actionMap . asset == m_Asset && m_Asset )
59
65
return m_Action ;
60
66
61
67
// Attempt to resolve action based on asset and GUID.
You can’t perform that action at this time.
0 commit comments