Hey guys I’m new here. I recently switched over to the Input System after running into bugs with the old Input Manager and I’m having some trouble replicating the behavior of the GetKeyDown method, using a singleton to handle inputs. Here’s my code.
string jumpPress = "jumpPress";
InputAction jumpPrsAct;
public bool jumpPrsInput { get; private set; }
void Awake()
{
jumpPrsAct = playerControls.FindActionMap(actionMapName).FindAction(jumpPress);
RegisterInputActions();
}
void RegisterInputActions()
{
jumpPrsAct.performed += context => jumpPrsInput = true;
jumpPrsAct.canceled += context => jumpPrsInput = false;
}
Stuff I’ve tried:
{
jumpPrsAct.started+= context => jumpPrsInput = true;
jumpPrsAct.performed+= context => jumpPrsInput = false;
}
*This just executes on the same update frame, instead of the desired one frame-after-another
Using the “Press Only” interaction is identical to the regular button action
I’m thinking that I need to access the callback context somehow but I’m having trouble learning how to do it. I can’t access context in the script that uses the controls because the action already seems to be packaged as a bool. Can someone walk me through this?