My part of the input code looks like this:
void Update()
{
y_input = Input.GetButtonUp(StaticStrings.Y);
delta = Time.fixedDeltaTime;
states.Tick(delta);
ResetInputNStates();
}
void GetInput()
{
vertical = Input.GetAxis(StaticStrings.Vertical);
horizontal = Input.GetAxis(StaticStrings.Horizontal);
b_input = Input.GetButton(StaticStrings.B);
a_input = Input.GetButton(StaticStrings.A);
y_input = Input.GetButtonUp(StaticStrings.Y);
x_input = Input.GetButton(StaticStrings.X);
rt_input = Input.GetButton(StaticStrings.RT);
rt_axis = Input.GetAxis(StaticStrings.RT);
if (rt_axis != 0)
rt_input = true;
lt_input = Input.GetButton(StaticStrings.LT);
lt_axis = Input.GetAxis(StaticStrings.LT);
if (lt_axis != 0)
lt_input = true;
rb_input = Input.GetButton(StaticStrings.RB);
lb_input = Input.GetButton(StaticStrings.LB);
rightAxis_down = Input.GetButtonUp(StaticStrings.L) || Input.GetKeyUp(KeyCode.T);
if (b_input)
b_timer += delta;
d_x = Input.GetAxis(StaticStrings.Pad_X);
d_y = Input.GetAxis(StaticStrings.Pad_Y);
d_up = Input.GetKeyUp(KeyCode.Alpha1) || d_y > 0;
d_down = Input.GetKeyUp(KeyCode.Alpha2) || d_y < 0;
d_left = Input.GetKeyUp(KeyCode.Alpha3) || d_x < 0;
d_right = Input.GetKeyUp(KeyCode.Alpha4) || d_x > 0;
}
The problem is that my Y button is connected with the function of changing from one hand weapon to two hand weapon, but the Y button only works a few times in game!
e.g., I have to press about 3 times then it works.
How do I solve this?