Can't get current control scheme

In the new Input System, I am trying to get the current control scheme, to tell whether the player is using a keyboard/mouse or a gamepad. I’ve tried several different ways, but all return null:

Debug.Log(playerInput.currentControlScheme);
and
if (playerInput.GetDevice<Gamepad>() != null) { Debug.Log("Player is using Gamepad"); }
and
playerActionMap = playerInput.actions.FindActionMap("Player");
In the first two examples, playerInput is a type of PlayerInput. In the third example, playerActionMap is a type of InputActionMap. In my input action, I have Gamepad and Keyboard control schemes. I still get null even when I set the default input to keyboard in the PlayerInput in the inspector. I’m missing something obvious…

I figured out the problem. I had several PlayerInputs in my scene, one attached to my player, and two more attached to cameras. Once I deleted the ones attached to my cameras, everything started working.