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

ButtonWithTwoModifiers: Cannot find public field 'Modifier 1'

Discussion in 'Input System' started by Vince82, Feb 10, 2022.

  1. Vince82

    Vince82

    Joined:
    May 9, 2014
    Posts:
    3
    After adding a ButtonWithTwoModifiers in my InputActions asset, I get this error

    InvalidOperationException: Cannot find public field 'Modifier 1' used as parameter of binding composite 'UnityEngine.InputSystem.Composites.ButtonWithTwoModifiers' of type 'UnityEngine.InputSystem.Composites.ButtonWithTwoModifiers'

    I checked the doc:
    https://docs.unity3d.com/Packages/c...System.Composites.ButtonWithTwoModifiers.html

    So manually changing the field name
    Code (CSharp):
    1. ""name"": ""Modifier 1"",
    to
    Code (CSharp):
    1. ""name"": ""modifier1"",
    in the generated file does solve the problem, but is there a way to not have to do this?
     
    fizzd likes this.
  2. fizzd

    fizzd

    Joined:
    Jul 30, 2013
    Posts:
    21
    I just had to do this rename as well, thank you for the tip!
     
  3. jackjansen

    jackjansen

    Joined:
    Apr 4, 2019
    Posts:
    22
    Same here: I googled the error message and arrived here, which fixed it for me. Thanks!

    As an extra data point: I got into this situation by changing a 1-modifier binding to 2-modifier. The old binding was now used as modifier-2, so I swapped modifier-2 and binding.
     
    marianomdq likes this.
  4. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,015
    @Schubkraft ping!

    I have also just encountered this problem.
     
  5. marianomdq

    marianomdq

    Joined:
    Sep 29, 2015
    Posts:
    17
    Thanks @Vince82, same thing happening here. I would have spent hours trying to figure it out.
     
  6. RisingSunStudios

    RisingSunStudios

    Joined:
    May 23, 2018
    Posts:
    32
    Still happening - Unity Input System 1.4.4

    *heavy sigh*