New Input System not Working with Netcode for GameObjects

I’m working on prototyping a multiplayer game using Unity’s Netcode for GameObjects system.

I followed along with the “Hello World” tutorial and wanted to add WASD movement for the players.

However, the player isn’t detecting the input.

I’m using an InputActionMap and a Vector2 which just reads the value of the first action on the map every frame, but when testing it the Vector2 doesn’t change at all.
I was able to get input working by switching it to the old input system and using GetAxis, but I would prefer to use the new InputSystem if possible.

Is there something that I’m missing, or does the new input system just not work with Netcode?

For reference I am using
-Unity Version 2021.3.15.f1
-The Input Systems PlayerInput Component on the Player Prefab

  • I am using the Client Network Transform instead of the network transform, giving the client control over their own object instead of needing permission from the server
    (more here “NetworkTransform | Unity Multiplayer Networking”).

To fix the issue of all but the host moving, I derived my player script from NetworkBehaviour and made an override for the OnNetworkSpawn(). Inside this method I checked to see if the current client had ownership of the object and if they were not the owner then to turn of the PlayerInput component.

-Additionally, I have found that setting the Default Scheme from a set device to fixed the problem, so it definitely seems to be an input conflict of some sort (at least for Keyboard and Mouse).

Below is the basic script showing what I have described along with a screenshot of my PlayerInput Component on my Player Prefab and Input Action Asset.

Hopefully you get some sort of insight from my tinkering.

public class PlayerNetwork : NetworkBehaviour
{
    [SerializeField] private float moveSpeed = 3f;

    private Vector3 _moveDir = new Vector3(0, 0, 0);

	public override void OnNetworkSpawn()
	{
        //If this is not the owner, turn of player inputs
        if (!IsOwner) gameObject.GetComponent<PlayerInput>().enabled = false;   
    }

	// Update is called once per frame
	void Update()
    {
        if (!IsOwner) return; //If this is not the owner, skip Update()

        transform.position += _moveDir * moveSpeed * Time.deltaTime;
    }

    //Called by the PlayerInput UnityEvents for Move keybinds
    public void OnMove(InputAction.CallbackContext callback)
    {
        Vector2 movement = callback.ReadValue<Vector2>();

        _moveDir = movement;
    }
}


Same problem here, I tried to move ‘PlayerActions.Player.Movement.performed += move_performed;’ into update, nothing changes, tried to make it without rigidbody using transform.position and progress was there but only without lerp, lerping is not working too.

I believe there is a bug with the current InputSystem (Unity 2022.1.20f1 or lower) and netcode.

Try this: use the new InputSystem, then run the game with netcode as host/client. You wont be able to move your Player prefab. But in the middle of the game go to your PlayerInput component and hit “Open Input Settings” - when there, try tweaking any value, such as Default deadzone Min (even if you dont use a controller) - make sure you do it while in Play Mode. Now see if you input works.

That’s what fixed it for me. So to get it working permanently using code, I just added this line:
InputSystem.settings.defaultDeadzoneMax = 0.924f;

to simulate changing that setting, and it works. not sure why.