Hello there,
I’m using recently the New Input System and I have a problem.
I don’t know how i can add multiple Prefab to the PlayerInputManager.
For the moment i can use 2 different controller to controll 2 different player but they have the same prefab.

I have looked for a solution but i didn’t find any explicit example.
If someone could help me I would be very grateful.
Thank you for your time.
I’m having this issue as well. Did you figure this out?
I hope i can help you.
This is my Solution for this Problem.
Make a Reference to the PlayerInputManager and the Prefab for Player B and when you initialize Player A you can change the Prefab in the PlayerInputManager.
Sorry for my bad english.
Here ist an example code
public PlayerInputManager inputManager;
public GameObject playerA;
public GameObject playerB;
public GameObject playerPrefabB;
void OnPlayerJoined(PlayerInput input)
{
if (playerA == null)
{
playerA = input.gameObject;
inputManager.playerPrefab = playerPrefabB;
} else
{
playerB = input.gameObject;
}
}
Hello,
Yes I solved my problem, thanks to this video :
I hope this help.
Video is unavailable. Can you please describe what happens or share a name of the video?
Heres my system.
I checked if a gameobject (the previous player prefab) with a tag (in this case my original prefab was tagged with Player 2), had spwaned in, then it would access the input manager’s prefab and change it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
//PLACE ON PLAYER MANAGER OBJECT
public class InputManagerController : MonoBehaviour
{
[SerializeField] private GameObject newPlayerPrefab; // The new Player Prefab to use.
public PlayerInputManager inputManager;
private void Update()
{
if (GameObject.FindWithTag(“Player2”)) //Checking for a game object with the tag
{
PlayerInputManager.instance.playerPrefab = newPlayerPrefab; //If yes, changes the player prefab field to your selected prefab
}
}
}