Input action for jumping

 avatar
unknown
csharp
a day ago
581 B
20
Indexable
//In my player movement script
public void OnJump(InputAction.CallbackContext context)
{
    if (context.started)
    {
        DebugEditor.Log("Jumping start");
    }
    if(context.performed)
    {
        DebugEditor.Log("Jumping performed");
    }
}


//In my input manager script
private void OnEnable(){
    Input = new InputMap();

    Input.PlayerInput.Enable();
    Input.PlayerInput.JumpInput.performed += PlayerMovement.instance.OnJump;
}

private void OnDisable(){
    Input.PlayerInput.JumpInput.performed -= PlayerMovement.instance.OnJump;
}
Editor is loading...
Leave a Comment