Question by
theedi80 · Oct 10, 2019 at 03:52 PM ·
inputmanagergetaxiscrossplatform
CrossPlatformInput GetAxis("Vertical") behave differently from Input.GetAxis("Vertical") !?
I am trying to use an up and a down on screen buttons to control a game object's transform.rotation. Code below,
//float vAxis = UnityStandardAssets.CrossPlatformInput.CrossPlatformInputManager.GetAxis("Vertical");
float vAxis = Input.GetAxis("Vertical");
if (vAxis != 0)
{
var rotationVector = transform.localRotation.eulerAngles;
rotationVector.z += vAxis * 50;
GunHead.transform.rotation = Quaternion.Euler(rotationVector);
}
With Input.GetAxis("Vertical") it works well, pressing up and down key will cause the object rotate quickly.
But when using CrossPlatformInputManager.GetAxis("Vertical") it doesn't work, pressing down the on screen button will only rotate the object a tiny bit and it just stop. Feels like the button down only trigger the axis value changes one time instead of repeatedly.
Comment