Search Unity

Resolved Input System Not Working Once Built

Discussion in 'Input System' started by Stephen1701, May 8, 2023.

  1. Stephen1701

    Stephen1701

    Joined:
    Mar 29, 2016
    Posts:
    132
    Hi,

    I'm using:
    Unity 2021.3.0f1
    Input System: 1.5.0
    Scripting Backend: IL2C))
    Active Input Handling: Input System Package (New)

    Input works fine in the editor, but it doesn't work when playing the Windows build.
    The architecture in the Build Settings is set to Intel 64-bit, but I've heard there is an Architecture option in the Player Settings Under Other Settings, which needs changing to x86_64, but I cannot find it.

    Any advice?

    Thanks
     
  2. Stephen1701

    Stephen1701

    Joined:
    Mar 29, 2016
    Posts:
    132
    I have an update.
    I have a class called InputManager (the class isn't static)
    This uses public static PlayerControls inputactions;

    PlayerControls is the class generated by the Input asset, so it contains all actions and controls for the game.
    Inside InputManager.Awake() a new instance of inputActions = new PlayerControls(); is created.
    This all works fine when playing in the editor, but when playing in a standalone build, it seems the Awake() is not called and so a new instance of PlayerControls is never created. So when the player attempts to access inputActions, it is null.

    I could be doing something really stupid, but why would it work fine in the editor but not when the game is built?
     
  3. Stephen1701

    Stephen1701

    Joined:
    Mar 29, 2016
    Posts:
    132
    It seems the way I had the system set up it would initialise the inputActions when the editor refreshes, which works fine in editor, but not in game. So I need to find a way around it.