📅  最后修改于: 2022-03-11 14:48:49.956000             🧑  作者: Mango
//Use this if you want to join players manually with unity's new input system
//This connects all active devices to a gameobject setup for inputsystem input
//Check your player prefab's player input component's Auto-Switch box
using UnityEngine.InputSystem;
void JoinConnectedDevices()
{
int playerNo = 0;
for(InputDevice device in InputSystem.devices)
{
playerInputManager.JoinPlayer(playerNo++, playerNo++, null, device);
}
}