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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

NotImplementedException when using InputControlPath.TryGetControlLayout on mouse controls

Discussion in 'Input System' started by a_weber, Mar 15, 2020.

  1. a_weber


    May 2, 2018
    I need to get the control layout of a mouse input, for example a left click or a right click. The issue is that calling InputControlPath.TryGetControlLayout on any path under the Mouse device layout will fail with a NotImplementedException. I have figured out that the culprits are <Mouse>/scroll/x and <Mouse>/scroll/y which have the isModifyingExistingControl flag set. I don't require these controls as <Mouse>/scroll does what they do, so disabling them in InputSystem/Devices/Mouse.cs works fine and resolves the issue. For maintainability reasons however, I do not want to modify any code in the InputSystem if possible. Is there any other way to disable/remove a control on a device? Is there any chance of this issue being fixed in the next version?

    Additionally, is there a smarter way to allow rebinding to accept either a stick or a button as part of a composite? The way I'm doing it, a 2d action needs to have a direct binding and a composite attached, when rebinding, the other is disabled by overriding the binding with an empty string. It just seems very clunky.

    Thanks for your time.
  2. Rene-Damm


    Unity Technologies

    Sep 15, 2012
    Thanks for reporting. Fix in landing pattern.

    Turns out the existing code is covering the case just fine. Was no need for it to special-case those controls.