- Home /
Joy Pad not working on My Android Device.
Hi, I have tested the joypad it is working on a project that I have downloaded from the Internet. But not working on my project. But when I used on PC build of my project it is working there. But when I go for android build it doesn't,t work on it. Plus I have also copied the input manager file of the running project to my project. Still, it is not working on my project. What is the problem? I am stuck in this thing. Looking forward to you.
My Code is as follows: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.CrossPlatformInput;
public class FPC : MonoBehaviour { Rigidbody m_Rigidbody; public float m_Speed=5.0f; public float jumpSpeed=2.0f; public string horizontalInput = "Horizontal"; public string verticalInput = "Vertical";
 void Start()
 {
     //Fetch the Rigidbody component you attach from your GameObject
     m_Rigidbody = this.GetComponent<Rigidbody>();
     //Set the speed of the GameObject
 }
 void Update()
 {
     if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W) || CrossPlatformInputManager.GetAxis(verticalInput)>0 || Input.GetKey(KeyCode.Y))
     {
         //Move the Rigidbody forwards constantly at speed you define (the blue arrow axis in Scene view)
         m_Rigidbody.velocity = transform.forward * m_Speed;
     }
     if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S) || CrossPlatformInputManager.GetAxis(verticalInput)<0 || Input.GetKey(KeyCode.X))
     {
         //Move the Rigidbody backwards constantly at the speed you define (the blue arrow axis in Scene view)
         m_Rigidbody.velocity = -transform.forward * m_Speed;
     }
     if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D) || CrossPlatformInputManager.GetAxis(horizontalInput)>0 || Input.GetKey(KeyCode.A))
     {
         //Rotate the sprite about the Y axis in the positive direction
         transform.Rotate(new Vector3(0, 1, 0) * 0.2f * m_Speed, Space.World);
     }
     if (Input.GetKey(KeyCode.LeftArrow) || CrossPlatformInputManager.GetAxis(horizontalInput)<0 || Input.GetKey(KeyCode.B))
     {
         //Rotate the sprite about the Y axis in the negative direction
         transform.Rotate(new Vector3(0, -1, 0) * 0.2f * m_Speed, Space.World);
     }
     if (Input.GetKeyDown (KeyCode.Space)){
     m_Rigidbody.velocity += jumpSpeed * Vector3.up;
 }
 }
}
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                