- Home /
Input.GetAxis wont work with UI controls
// Normal Movements Variables
public float Speed;
void FixedUpdate()
{
// Move senteces
GetComponent<Rigidbody2D>().velocity = new Vector2(Mathf.Lerp(0, Input.GetAxis("Horizontal")* Speed, 0.8f),
Mathf.Lerp(0, Input.GetAxis("Vertical")* Speed, 0.8f));
}
}
Now this works great on my keyboard for what I need.....However....I'm trying to port my game to mobile and it's not working. No matter what kind of UI controls I give, it wont work. I figured the crossplatforminput would work, but it doesn't. I'm using the Joystick.cs file that comes with unity.
Comment
Your answer
Follow this Question
Related Questions
Joystick stops working after scene is restarted from UI button 1 Answer
Use Canvas Buttons as Input Axis 1 Answer
How to Load a specific SaveGame from a buttonclick 1 Answer
How to rotate boject using UI button? 3 Answers
How to make a UI Canvas not appear again after the first time the user hits the "I Agree" button. 2 Answers