Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question XR Devices always updating button presses in LateUpdate

Discussion in 'Input System' started by Deleted User, Jun 7, 2020.

  1. Deleted User

    Deleted User

    Guest

    The documentation shows we have control of when the input system updates and fires events;
    https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Settings.html

    I'm listening for the .performed event for a button click, and I have set the input settings to run in Dynamic update (also tried Fixed). It seems that button click always - without fail - executes in the LateUpdate frame.

    This is frustrating, because certain motions - eg, click a button to execute a snapturn - will show your hands in the previous position for a frame, because the hand position also updates in LateUpdate - I suppose sooner than the snapturn code fired.

    The documentation seems to imply the inputs will trigger their events roundabout the Update loop timing and consume them, then triggers it again in LateUpdate for XR devices explicitly:

    But this doesn't seem to be the case; it seems updates are only and explicitly only happening in LateUpdate.

    I've tried setting our own internal script execution order to be very high (32000) and in a LateUpdate loop, but it seems the input system fires after this regardless.

    A hacky workaround is for us to process our inputs OnPreRender (URP, so technically Application.onBeforeRender), so we have a way to handle things --

    but it would be really nice to actually have the inputs consumed on Update as expected from the documentation -- or at least for things like buttons to not be parsed in the "bonus" update loop that the docs say are injected.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    XR devices updating in late update is by design. *However*, this is meant to be restricted to transforms so that camera transforms are fresh. It's not meant to trigger buttons there.

    Would you mind filing a ticket with the Unity bug reporter?
     
  3. Deleted User

    Deleted User

    Guest

    Bug reported with sample project! Case # 1254142.
     
    Rene-Damm likes this.