Search Unity

UI Input Module breaks on reload

Discussion in 'Input System' started by Ofx360, Jun 14, 2020.

  1. Ofx360

    Ofx360

    Joined:
    Apr 30, 2013
    Posts:
    155
    Using the New Input system's UI Input Module, every time i hot-reload my game after a code edit, the UI interaction stops working forcing me to quit play mode and re-enter. It's pretty annoying. The current fix is to just use the old Standalone Input Module with the old input system

    This is probably a known issue (if not, i can report it), but are there any plans to fix this?
     
    idbrii likes this.
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Actions unfortunately don't support domain reloads in play mode ATM. While a known issue, feel free to report it as an issue with the bug reporter, though.
     
  3. idbrii

    idbrii

    Joined:
    Aug 18, 2014
    Posts:
    51
    Reported it privately, but I don't know how to submit it to the public "vote on what we should fix" forum (everything points to unity feedback which is dead).

    Workaround:

    Re-create the controls in OnEnable(). Not sure how reliable this is, but it seems to work.

    Code (CSharp):
    1. public void OnEnable()
    2. {
    3.     // Unity input doesn't support reloads, so it may get wiped.
    4.     if (m_Controls == null)
    5.     {
    6.         m_Controls = new SimpleControls();
    7.     }
    8.     // end modification
    9.     m_Controls.Enable();
    10. }
    11.  
    If this is the interim solution, could you add it to the importable sample code?
     
  4. HellzStormer

    HellzStormer

    Joined:
    Feb 7, 2021
    Posts:
    2
    Any news on this? It's definitely a workflow killer to have to restart the app anytime I change the code.

    To clarify in my case, I have code which directly checks the inputs, using Mouse.current. That code still works.

    But I also use EventSystem, and that just seems to stop firing.

    In the meantime, I reverted to the legacy input.

    Edit: Using InputSystem 1.0.2 on Unity2020.3.0f1
     
    Last edited: Mar 28, 2021