Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Multiplayer Player Input issue (Second player doesn't get auto assigned a device)

Discussion in 'Input System' started by tv_Never, Mar 23, 2023.

  1. tv_Never

    tv_Never

    Joined:
    Nov 11, 2021
    Posts:
    11
    Hello,

    I'm currently facing an issue where my player prefab (host) spawns and works correctly, however when a second player joins (client) and spawns they don't have any devices assigned in the player input.

    The prefabs for both players are the same, each having its own Player Input.

    I am able to get the player inputs through "PlayerInput.all[0]" (for the host) and "[1]" for the second player. Which proves they are assigned. However, when I try to use a call on PlayerInput.currentControlScheme, the host is OK and will come up with "M&K" but the client will come up with null. Now both players are instantiated the same.

    Any ideas on how to get the player to be assigned with a currently active device for currentControlScheme.

    Thanks!
     
  2. tv_Never

    tv_Never

    Joined:
    Nov 11, 2021
    Posts:
    11
    Could this be a bug?
     
  3. tv_Never

    tv_Never

    Joined:
    Nov 11, 2021
    Posts:
    11
    Ok found it out myself. Turns out that when using multiplayer (similar to the camera) you need to disable the PlayerInput component and enable it in the OnStartAuthority() or isLocalPlayer()