- Home /
How to use crossplatforminput buttons as getaxisraw("Horizontal")
i have a gameobject that moves left to right but Pressing right and left arrow. it works fine on pc, however now i want to do the same in mobile, however with two buttons left and right. On the pc i had the script.
void Update()
{
float move = Input.GetAxisRaw("Horizontal");
MyRigitbody.velocity = new Vector2(move * 6, 0f);
}
The object moved as i hold down right or left arrow, how can i do the same with buttons? i am trying to use crossplatforminput with two buttons right and left, however it only has crossplatforminput.getbuttondown("Left"), it does not have the same system as inputaxisraw, so i am unable to move object with velocity every time in press or hold left and right button any suggestion?
Answer by givexa · Apr 05, 2021 at 07:29 PM
Solved! here is a very good video for it https://www.youtube.com/watch?v=_zyx8lCIb5A
Your answer
Follow this Question
Related Questions
How to make arch knockback 3 Answers
Unity 2d mobile movement 0 Answers
Adding a velocity to a rigid body inst working. 1 Answer
Unity 2D: move towards mouse and through mouse 1 Answer
Random Object movement 2 Answers