I’m using Unity version 2018.1.6f1, and I’ve programmed the First Person Character to zoom in for 5 seconds and zoom out for another 5 seconds afterward once the scene starts. This works fine on the Unity Editor on my laptop but does not run when I build and run it onto a phone. There aren’t any errors in the adb logcat, so I’m not sure what is wrong. Below is my code:
string rrr = "E";
float counter = 0;
void Update(){
Boolean up, down = true;
counter += Time.deltaTime;
if (counter <=5 ){
rrr = "U";
}
if (counter > 5 && counter <= 10) {
rrr = "D";
}
try{
while (up && rrr.Equals("U")){
movein();
up = false;
}
while (down && rrr.Equals("D")){
moveout();
down = false;
}
}
private void movein(){
transform.position += transform.forward * 50 * Time.deltaTime;
Debug.Log("running movein");
}
private void moveout()
{
transform.position += transform.forward * -50 * Time.deltaTime;
Debug.Log("running movenout");
}
}