What about addressables when using the new input?

If I spawn a player with the player input manager, I assume it does a default instantiate.
So what do I do if I spawn the player through addressables?

I guess I have to use the spawn manually option but how do I detect which controller pushed a button to call to JoinPlayer() function?

Before new input I was using an X_Input wrapper so I would just update all controller states in update and see which controller pushed the start button so how do I convert that functionality to the new input?

1 Like

Did you ever figure out a solution? I’m looking for a similar answer w.r.t. UI Buttons. I have a “start” button, and I want to know which controller generated the submit event.

– pryankster

Ye you have to manually code the join logic, couldn’t find a way around it.
Basically just check in update when any controller pushes start and assign that controller manually to playerInput.
It’s not really a full solution but it works for now.

void Update() {
if (Gamepad.current != null) {
if (Gamepad.current.startButton.wasPressedThisFrame) {
SpawnPLayer(Gamepad.current);
}
}
}

void SpawnPLayer(InputDevice device) {
//You can stall the code here if you wanna load the prefab somewhere else for example
PlayerInput newPlayerInput = PlayerInput.Instantiate(RoninPrefab,-1,"Gamepad",-1, device);
GameObject newPlayer = newPlayerInput.gameObject;
// Assign values to your newPlayer object here as normal
}