Search Unity

Feature Request DeferBindingResolution - make public

Discussion in 'Input System' started by OndrejP, Apr 25, 2022.

  1. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    Make
    InputActionRebindingExtensions.DeferBindingResolution()
    public.

    I'm currently using reflection to call this method:

    Code (CSharp):
    1. static readonly Func<IDisposable> m_deferBindingResolutionAcquire = typeof(InputActionRebindingExtensions).GetStaticMethod<Func<IDisposable>>("DeferBindingResolution");
    Why I need it?
    I allow movement input when UI is active (like in PUBG).
    When UI is activated I need to set device filter on certain action maps and BindingMask filters on certain actions. Deferring improves performance a lot (from ~15ms to ~3ms). It's still not ideal, but acceptable.

    In ideal world:
    Store resolved input bindings as opaque object. Then activate these previously resolved input bindings without any performance hit. Re-resolve would be needed only when user rebinds inputs or new device is connected, but that's totally fine (happens very rarely during gameplay).