Search Unity

Question 2021.1.19 + preview17 + new input system = no over states

Discussion in 'UI Toolkit' started by Timboc, Sep 8, 2021.

  1. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    Having upgraded our project from 2020.3 to 2021.1 one of the issues we're struggling with is how our mouse over/move etc states no longer work - only clicks. We've tried:

    - Event System with Input System UI Input Module - PanelRaycaster is successfully raycasting and hitting specific elements but we're getting no psuedo state changes etc. Unsure how to follow this chain in code further.

    - InputSystemEventSystem (this is what we originally had in 2020.3) now throws an error that
    UIElementsRuntimeUtility.activeEventSystem
    is null.

    - Using the Standalone Input Module and setting our project to use both the new and old input systems - the StandaloneInputModule is just replaced at runtime with the InputSystemUIInputModule component.

    We required this upgrade due to URP & VFX issues. Any tips on workarounds or if this might be a bug?
    Many thanks in advance.
     
  2. uBenoitA

    uBenoitA

    Unity Technologies

    Joined:
    Apr 15, 2020
    Posts:
    220
    The UI Toolkit package preview 17 should work with 2021.1, yes, including runtime events.

    What seems to be happening in your case is that [UIToolkit + UGUI] support started in 2021.1, meaning InputSystemUIInputModule will now automatically send events to UI Toolkit and replace the old InputSystemEventSystem.

    Just to remove as much noise as possible, could you start a test where your scene has the EventSystem + InputSystemUIInputModule set up in advance and not activated only by some runtime script? Also make sure you don't have the InputSystemEventSystem, because now your events will be handled by UGUI's event system.
     
    Timboc likes this.
  3. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    Super appreciate the reply @uBenoitA.
    Eventsystem setup in 2021.1.19f1, input set to New system only (as on 2020.3):
    upload_2021-9-13_17-28-47.png
    All enabled from start - not changed at runtime and I also can't see the presence of InputSystemEventSystem at runtime so I think the setup is as described. I seem to be able to repro this fairly easily. Is there a way I can easily modify the samples to see if they work with the new input system in a blank project?

    Separately, re rollback:
    After successfully using the new input systems for months on 2020.3 I'm currently trying to roll back to the old input system and failing massively. When I e.g. inspect the EventSystem it thinks I'm using the new inputsystem (despite ENABLE_INPUT_SYSTEM define being false). Looking at the code, it seems to be the case if the `enableNativePlatformBackendsForNewInputSystem` is null and UNITY_INPUT_SYSTEM_ENABLE_UI is set? Is there a way to unset the UNITY_INPUT_SYSTEM_ENABLE_UI define? So confused quite honestly.
     
  4. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    I also tried hooking it up to the default Input Action Asset fwiw:
    upload_2021-9-13_17-57-41.png
     
  5. uBenoitA

    uBenoitA

    Unity Technologies

    Joined:
    Apr 15, 2020
    Posts:
    220
    Oh. Another important thing: new Input only supports UI Toolkit properly since its 1.0.0-pre.5 version. In your packages.json, try having the following line:
    "com.unity.inputsystem": "1.1.0-pre.5",
     
    Timboc likes this.
  6. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    Legend! We were already on 1.0.2 but according to my quick late night test just now, updating to 1.1.0-pre.5 has done the trick! Will double check in a build tomorrow. Combined with the Input System UI Input Module that's looking like a magic combo, thank you!