InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

InputActionAssetReference fields are untyped

Open Baste-RainGames opened this issue 7 years ago • 1 comments

I've got an input action asset that generates a C# script:

image

I've got a script with a public field of that type:

image

When assigning the field, I think I should only be able to assign the same input action asset that the type defines, but I can assign all of them:

image

That shouldn't be possible, right? If I assign menu input there, I get all kinds of trouble:

KeyNotFoundException: Could not find an action map called 'KnightMap' in asset 'MenuControls (UnityEngine.Experimental.Input.InputActionAsset)' UnityEngine.Experimental.Input.InputActionAsset.GetActionMap (System.String name) (at Library/PackageCache/[email protected]/InputSystem/Actions/InputActionAsset.cs:318) KnightControls.Initialize () (at Assets/Input/KnightControls.cs:22) KnightControls.get_KnightMap () (at Assets/Input/KnightControls.cs:114) InputTester.Awake () (at Assets/InputTester.cs:15)

Baste-RainGames avatar Jan 19 '19 13:01 Baste-RainGames

Closing for it is tracked: https://issuetracker.unity3d.com/issues/scripting-inputactionassetreference-fields-are-untyped

JiaUnity avatar Apr 09 '19 22:04 JiaUnity