- Home /
How Do I Access 1D Axis in New Input System?
Thus far I have not been able to find much information on how to implement 1D Axis Composites from the new Input System into a script. I understand how to use 2D and 3D axes by using Get<Vector2D>()
or Get<Vector3D>()
, but I am not sure how to implement the 1D axis in a similar fashion. Here is my code:
public void OnSelectPath(InputValue input)
{
int change = Convert.ToInt16(input.Get<float>());
if (runningCutscene)
{
if (ongoingProcesses == 0)
{
int newChoice = currentChoice + change;
if (newChoice >= ShownChoices.Count)
{
newChoice = 0;
}
if (newChoice < 0)
{
newChoice = ShownChoices.Count - 1;
}
currentChoice = newChoice;
Select(currentChoice);
}
}
}
According to the documentation (to the degree that I understood it), the 1D axis should return a Single, so that's what I tried to use here. The local variable change
should ideally be set to 1, 0, or -1 depending on which key is pressed. However, whenever the positive or negative keys are pressed, change
still returns 0. What am I doing wrong? Thanks!
Your answer

Follow this Question
Related Questions
how to use the axises on the xbox one controller? 0 Answers
Mouse Axis in 3D Space based on RaycastHit normal? 0 Answers
Microphone input volume to axis value translation 1 Answer
Force input on Button? 1 Answer
Input Axis Mouse y is not setup 3 Answers