Unity Input System 1.0.0

Hello, I’m having trouble with the new input system.
It works fine in editor, but not when I do an x86_64 build, what am I doing wrong?

(Forgot to say, i’m currently using a wired xbox one controller.)

This is basically the code i’m using:

using UnityEngine.InputSystem;


public class InputManager : MonoBehaviour
{
    public Gamepad gamePad = Gamepad.current;
    public Vector2 move = new Vector2();
    public Vector2 rotate = new Vector2();
  
    void Update()
    {

        bool crouch = gamePad.buttonEast.isPressed;
        bool interactPrimary = ( gamePad.leftTrigger.ReadValue() >= 0.5 );
        bool interactSecondary = (gamePad.rightTrigger.ReadValue() >= 0.5);

        move = gamePad.leftStick.ReadValue();
        rotate = gamePad.rightStick.ReadValue();
    }
}

And here’s a snip of my unity settings.

No one? Nothing? Not even a nudge in the right direction?

I’m new with the Input System too, but have you tried looking at your debug logs to confirm if your trigger events are being registered?

Move this to OnEnable or Start. The initializer will run as part of the constructor and, with this being a serialized object, will thus run during loading. This works in the editor as the input system will have been started as part of the editor but won’t work in the player as the system is still starting up. So you get null here.

2 Likes

Move this to OnEnable or Start.
Such a simple answer, such a stupid mistake to make.

Many thanks, that’s solved it.