- Home /
transform.Translate not working after exporting to Android
I'm building a VR app for Cardboard and I'm trying to move the camera/user to a different place using this block of code:
if (Input.GetMouseButton (0))
{
Debug.Log ("Pressing button");
transform.Translate (Vector3.forward * speed * Time.deltaTime);
}
After I run the app in the Android device, while holding touch, the monitor from the Android SDK shows the debug message, but the camera doesn't move.
Answer by BodhiPurplePill · Apr 07, 2017 at 12:52 PM
When using VR, in most cases the camera's LOCAL position can't be moved. It is overridden by Unity. Give the camera a parent, and move the parent.
Answer by Cuttlas-U · Apr 07, 2017 at 09:52 AM
hi u cant use "Input.GetMouseButton (0)" for android build cause its a mouse function not a touch ;
Input.Get$$anonymous$$ouseButton (0) can be used on a touch device. It's recognized as a touch. The poster said that "the monitor from the Android SD$$anonymous$$ shows the debug message", thus, the function is correctly called.