-
Notifications
You must be signed in to change notification settings - Fork 322
FIX: PlayerInput does not work with C# wrappers (ISXB-1535) #2188
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
base: develop
Are you sure you want to change the base?
Changes from all commits
a6f71c0
21ad066
2eb009a
81d708a
a37ee76
f7b6585
adb79c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -342,14 +342,8 @@ public InputActionAsset actions | |
UninitializeActions(); | ||
} | ||
|
||
var didChange = m_Actions != null; | ||
|
||
m_Actions = value; | ||
|
||
if (didChange || m_Enabled) | ||
// copy action asset for the first player so that the original asset stays untouched | ||
CopyActionAssetAndApplyBindingOverrides(); | ||
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 am still concerned with removing the copy for the first player. 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.
Can you specify which conflicts have occurred before? I'm not aware of any other bugs/conlfits that would require a copy for the first player. 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. What I am referring to is that the project wide actions was the first occurrence, since the asset can be operated freely from anywhere else without further restrictions I think it's not unlikely to encounter similar problems in the future (even if we can not directly think of one now). 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 believe project-wide actions didn't consider this use case during the design phase. In the end, PWA it's just another asset with a "small" difference that has all actions enabled. The normal behavior of an asset is to come with actions disabled. But this is not really relevant to the discussion of doing copies, which I want to explore further. Making a copy during assignment (playerInput.asset = myAsset) is problematic for two reasons:
I feel we get into a slippery slope of inconsistencies if we go down the path of doing copies for every asset assignment. I'm fine with going with a different direction, but I would like to remove the copy behavior on assignment regardless of what we agree on doing. 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 agree on that, assigning with a copy under the hood and the reference is indeed confusing.
I think the third option is the solution you proposed, which rolls back to the previous inconsistent state. I think that's valid with the argument to not break anything, though I believe it's not ideal in terms of consistent behaviour. |
||
|
||
if (m_Enabled) | ||
{ | ||
ClearCaches(); | ||
|
@@ -960,6 +954,15 @@ public void ActivateInput() | |
|
||
m_InputActive = true; | ||
|
||
// Disable project-wide actions if they are being used by this PlayerInput. | ||
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS | ||
if (m_Actions != null && m_Actions == InputSystem.actions) | ||
{ | ||
InputSystem.AllowEnableActionsAfterEnterPlayMode(false); | ||
InputSystem.actions.Disable(); | ||
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. This will have an effect on the PlayerInput asset too, is disabling of all actions intended at this spot? |
||
} | ||
#endif | ||
|
||
// If we have no current action map but there's a default | ||
// action map, make it current. | ||
if (m_CurrentActionMap == null && m_Actions != null && !string.IsNullOrEmpty(m_DefaultActionMap)) | ||
|
@@ -1810,13 +1813,6 @@ void Reset() | |
|
||
#endif | ||
|
||
private void Awake() | ||
{ | ||
// If an action asset is assigned copy it to avoid modifying the original asset. | ||
if (m_Actions != null) | ||
CopyActionAssetAndApplyBindingOverrides(); | ||
} | ||
|
||
private void OnEnable() | ||
{ | ||
m_Enabled = true; | ||
|
Uh oh!
There was an error while loading. Please reload this page.