- Home /
How to convert Input.GetAxis To Android Controller
please help this is my script using UnityEngine; using System.Collections;
public class Move1 : MonoBehaviour {
public float MoveSpeed;
private Vector3 input;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
input = new Vector3(Input.GetAxisRaw("Horizontal"), 0,Input.GetAxisRaw("Vertical"));
if (GetComponent<Rigidbody>().velocity.magnitude < MoveSpeed){
GetComponent<Rigidbody>().AddForce(input * MoveSpeed);
}
}}
Comment
Answer by abhishek7 · Apr 06, 2016 at 02:42 PM
Input.GetAxis() is not compatible with mobile architecture. You need to use Unity API specific to mobile API. Look up Unity Android Documentation to learn how to do this.
Your answer
Follow this Question
Related Questions
How to track an object per Frame? 1 Answer
Simple score system 3 Answers
Performance of Line Renderer Functions 0 Answers
how to make the canvas child to share only the screenshot. 0 Answers