Heureka. I made it. The hickup was in the way Playmaker actions work. My solution is to call enable
On Enter, and disable
On Exit. This way, the action should keep listening during the active state, and not listen when the state is not active. But I only have dangerous half-knowledge, so please anyone (looking at you, Jean
) who feels like it, chime in and improve
I've made three actions for all three current types (plus variants, see in the threads below):
GetBinding: is like
Get Button and
Get Key.
Get1dAxisComposite: is like
Get Axis, Horizontal / Vertical
GetVector2Composite: new! Both axes, gets WASD, stick, dpad etc. It also automatically adjusts for diagonal inputs.
Beginner Crash Course GuideBeware! These are Beta Versions for now. If you want to test them, here's how this works. The Input System is compatible with the older system (you can use both or keep using the old one).
(setup begins at 1:20)
Step 1: Install the Input System PackageYou'll find it in the package manager (Window > Package Manager). It's currently in preview, and you need to fiddle with the options on top to show preview packages. In one case, it only worked after
restarting Unity.
Step 2: Make an Input AssetYour controls are now stored in a new asset file. This is nice because you can easily store it away, re-use it or share it. To make one, right-click in Project > Input Action. Name it, e.g. Controls. When you select it, note in the inspector that it generates a C# class. Right now, the path is a bit buggy. The correct path starts with a folder
within assets, e.g. Scripts/Controls.cs (note the full file name).
Step 3: Make an Action MapDoubleclick to open the asset. You probably have different controls in the pause menu, on the map screen or during the main game. The Action Maps, on the left column, are for that purpose. Start with one, say
Play, to group actions during gameplay. Whatever name you give, you need to set the same name in the Playmaker actions.
Step 4: Create an ActionNow define an Action, for example
Jump, and then you assign any number of keys or buttons to this action with the little plus button. Note what type you use, and use the corresponding Playmaker action later on. Create a new action for every action the player can perform. Note that by default, the binding register for both pressing and releasing (see next step). Tip: you can expand the Input Actions asset in the Project and see your Action Map and Actions easily, e.g. Controls > Play/Jump.
Step 5 (Optional): AdvancedYou can also create Control Schemes (upper corner) and then assign your bindings to any number of them. It's also possible to configure how the input is registered, e.g. button down, button up, etcetera and much more. You find the settings under
Interactions. For Jump to only care about pressing, click on Interactions > Press. I advise reading better documentation than my quick crash course if you're interested in advanced features.
Cheers.
Attachments are down-thread.