Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Canvas UI still references old Input system even when I install the new InputSystem

Discussion in 'Scripting' started by KokodokoGames, Jul 27, 2020.

  1. KokodokoGames

    KokodokoGames

    Joined:
    May 20, 2014
    Posts:
    40
    I installed the new InputSystem package, and created actions and code that can read the actions, according to several tutorial videos.

    This all works fine, until I add a UI element (a Slider). Then, I suddenly get errors about some base UI code that still references the old system.

    Code (CSharp):
    1. You are trying to read Input using the UnityEngine.Input class,
    2. but you have switched active Input handling to Input System package in Player Settings.
    3.  
    4. UnityEngine.EventSystems.BaseInput.GetButtonDown
    Apparently somewhere in the UI system the old InputSystem is still being referenced?

    The only thing I can find about this in the QuickStart is a reference to InputSystemUIInputModule
    But that's not relevant, because I didn't use the old StandAloneInputModule.

    I have temporarily fixed it by allowing the old input system in the player settings, but that can't be the answer! How do I use the new InputSystem with Unity UI?
     
  2. KokodokoGames

    KokodokoGames

    Joined:
    May 20, 2014
    Posts:
    40
    OK never mind... I found that the InputSystemUIInputModule has to be placed on the EventSystem that gets generated by the canvas. I can't delete this thread apparently :)
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    Sounds like the UnityEngine.UI.Slider probably uses the old Input system... perhaps there is a new replacement for the UnityEngine.UI namespace that uses the new package? Haven't gone down that path yet myself but it's something to check into.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    DON'T DELETE STUFF ! Jeez, let others find what they need to know!
     
  5. KokodokoGames

    KokodokoGames

    Joined:
    May 20, 2014
    Posts:
    40
    When you add a canvas with event system, it doesn't check if you are using the new input system. You have to manually click the EventSystem and click the button to generate the new InputSystemUIInputModule

    Hopefully this will be fixed in a future update :)
     
    TravisMeares and Kurt-Dekker like this.
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    Thanks for coming back to post this; I'm sure you will save someone's bacon in the future, perhaps mine!
     
    Coco07 likes this.
  7. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    2 years later this problem is still there.
    The "new" input system is probably 3 years old now.
    Maybe Unity can consider making it either standard or at least ensures other module will adapt themselves.
    The component can detect the project is using the new system as after finding this thread, I saw the error message on the EventSystem.
    So why not automatically change it instead of having us click the button, or at least create a prompt when adding a Canvas.
     
    James_Whitehouse likes this.