- Home /
Question by
Muhammedkoc07 · Jun 03 at 07:24 PM ·
input
input system sometimes detects keys
this input codes:
public void AllInputs() {
if (Player1B)
{
movementInput = controls.MovementA.Player1.ReadValue<Vector2>();
}
else if (Player2B)
{
movementInput = controls.MovementA.Player2.ReadValue<Vector2>();
}
if (Player1B)
{
if (Input.GetKeyDown(KeyCode.E))
{
shoot();
Debug.Log("shoot");
}
if (controls.Jump.Player1.WasPressedThisFrame())
{
animator.SetBool("Jump", true);
Jump();
Debug.Log("asda");
}
}
else if (Player2B)
{
if (InputActionButtonExtensions.GetButtonDown(controls.Shoot.Player2))
{
shoot();
}
if (InputActionButtonExtensions.GetButtonDown(controls.Jump.Player2))
{
animator.SetBool("Jump", true);
Jump();
Debug.Log("asda");
}
}
}
this Updates Codes:
private void Update() { if (DiePlayer || StopC) return;
HorizontalInput = movementInput.x;
AllInputs();
animator.SetFloat("yVelocity", rb.velocity.y);
}
private void FixedUpdate()
{
if (DiePlayer || StopC)
return;
GroundCheck();
Move(HorizontalInput);
}
Comment
Your answer
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Controller Joystick Hold Delay Logic? 1 Answer
Input Shift name 2 Answers
Gyroscope.userAcceleration returning zero 0 Answers
iphone input 1 Answer