While I used just Input it was better. But with CrossPlatformInput it doesn’t work at all.
I used this script, but with only switched Input to CrossPlatfromInput.
My gampead is Mad CATZ CTRL R - checked with bluetooth and PC modes. Unity 5.6.
Also I don’t really know why we need CrossPlatformInput, usual input seems works the same way in Editor and on Android device ?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityStandardAssets.CrossPlatformInput;
public class GamePadRenderer : MonoBehaviour {
float speed = 0.01f;
float rotation;
public GameObject aButton;
public GameObject bButton;
public GameObject xButton;
public GameObject yButton;
public GameObject leftThumbstick;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(CrossPlatformInputManager.GetButton ("AButton")) {
aButton.active = false;
} else {
aButton.active = true;
}
if(CrossPlatformInputManager.GetButton ("BButton")) {
bButton.active = false;
} else {
bButton.active = true;
}
if(CrossPlatformInputManager.GetButton ("XButton")) {
xButton.active = false;
} else {
xButton.active = true;
}
if(CrossPlatformInputManager.GetButton ("YButton")) {
yButton.active = false;
} else {
yButton.active = true;
}
rotation = CrossPlatformInputManager.GetAxis ("XAxis");
Debug.Log (rotation);
if (Mathf.Abs(rotation) >= 0.2f)
leftThumbstick.transform.eulerAngles = new Vector3 (0, 0, -rotation * 10);
}
}
