I thought i figured out a way with the new input system but it doesn’t work as other scripts don’t read the key as being performed which is fucking up my code I just need a way to implement getkeydown with new input system this is the way I have done it (Iam trying to fix The interact button)
public void Update()
{
if (InteractButton)
{
InteractButton = !InteractButton;
}
if (TestButton)
{
TestButton = !TestButton;
}
}
private void OnEnable()
{
if(playerControls == null)
{
playerControls = new PlayerControls();
playerControls.PlayerMovement.Movement.performed += i => movementInput = i.ReadValue<Vector2>();
if (CanInteract)
{
playerControls.PlayerActions.X.performed += i => InteractButton = true;
}
if (CanRun)
{
playerControls.PlayerActions.B.performed += i => RunButton = true;
playerControls.PlayerActions.B.canceled += i => RunButton = false;
}
if (CanJump)
{
playerControls.PlayerActions.Jump.performed += i => JumpButton = true;
}
playerControls.PlayerActions.RT.performed += i => CatchButton = true;
if (CanEquip)
{
playerControls.PlayerActions.RB.performed += i =>
{
if (EquipButton)
{
EquipButton = false;
}
else
{
EquipButton = true;
}
};
}
}
playerControls.Enable();
}