Search Unity

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,053
    @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:
    34
    Still happening - Unity Input System 1.4.4

    *heavy sigh*
     
  7. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    178
    Still happening with 1.7.0, and this time it happens with the TwoModifiersComposite

    Code (CSharp):
    1. InvalidOperationException: Cannot find public field 'Modifier 1' used as parameter of binding composite 'UnityEngine.InputSystem.Composites.TwoModifiersComposite' of type 'UnityEngine.InputSystem.Composites.TwoModifiersComposite'
    2. UnityEngine.InputSystem.InputBindingResolver.AssignCompositePartIndex (System.Object composite, System.String name, System.Int32& currentCompositePartCount) (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Actions/InputBindingResolver.cs:705)
    3. UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap actionMap) (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Actions/InputBindingResolver.cs:387)
    4. UnityEngine.InputSystem.InputSystem:AddDevice(String, String, String)
     
    Last edited: Nov 9, 2023
  8. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    Anyone submitted a bug report for this?

    Not seeing this fixed in the changelog