Skip to content

Commit ae27089

Browse files
committed
reset
1 parent 4f64381 commit ae27089

File tree

1 file changed

+12
-5
lines changed
  • Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput

1 file changed

+12
-5
lines changed

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,11 +1373,18 @@ private void InitializeActions()
13731373
if (m_Actions == null)
13741374
return;
13751375

1376-
// don't use original asset, duplicate it.
1377-
// this avoids operating on the project wide action asset
1378-
// this also avoids operating on assets that are shared between multiple players
1379-
// and to not change assets that are used in other places (InputSystemUIInputModule)
1380-
DuplicateActionsForPlayer();
1376+
// don't use project wide action asset for player input, but duplicate it
1377+
if (InputSystem.actions != null && InputSystem.actions.Equals(m_Actions))
1378+
DuplicateActionsForPlayer();
1379+
1380+
// Check if we need to duplicate our actions by looking at all other players. If any
1381+
// has the same actions, duplicate.
1382+
for (var i = 0; i < s_AllActivePlayersCount; ++i)
1383+
if (s_AllActivePlayers[i].m_Actions == m_Actions && s_AllActivePlayers[i] != this)
1384+
{
1385+
DuplicateActionsForPlayer();
1386+
break;
1387+
}
13811388

13821389
#if UNITY_INPUT_SYSTEM_ENABLE_UI
13831390
if (uiInputModule != null)

0 commit comments

Comments
 (0)