ButtonWithTwoModifiers: Cannot find public field 'Modifier 1'

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/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.Composites.ButtonWithTwoModifiers.html

So manually changing the field name

""name"": ""Modifier 1"",

to

""name"": ""modifier1"",

in the generated file does solve the problem, but is there a way to not have to do this?

2 Likes

I just had to do this rename as well, thank you for the tip!

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.

1 Like

@Schubkraft ping!

I have also just encountered this problem.

Thanks @Vince82 , same thing happening here. I would have spent hours trying to figure it out.

Still happening - Unity Input System 1.4.4

heavy sigh

1 Like

Still happening with 1.7.0, and this time it happens with the TwoModifiersComposite

InvalidOperationException: Cannot find public field 'Modifier 1' used as parameter of binding composite 'UnityEngine.InputSystem.Composites.TwoModifiersComposite' of type 'UnityEngine.InputSystem.Composites.TwoModifiersComposite'
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)
UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap actionMap) (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Actions/InputBindingResolver.cs:387)
UnityEngine.InputSystem.InputSystem:AddDevice(String, String, String)

Anyone submitted a bug report for this?

Not seeing this fixed in the changelog

1 Like