# problem with coroutine in android

it’s my code ,it rotates player.(hands head,legs ,and …)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class childsToRotate : MonoBehaviour {
public float minRot;
public float maxRot;
public float Speed;

void Start(){
StartCoroutine ("Rotate");
}
public IEnumerator Rotate (){
if (minRot < maxRot) {
if (minRot >= 0) {
for (float b = transform.localEulerAngles.z; b < maxRot;) {
b += Speed;
transform.localRotation = Quaternion.Euler (0, 0, b);
yield return null;
}
} else if (minRot < 0) {
for (float b = transform.localEulerAngles.z - 360; b < maxRot;) {
b += Speed;
transform.localRotation = Quaternion.Euler (0, 0, b);
yield return null;
}
}
} else if (minRot > maxRot) {
if (minRot >= 0) {
for (float b = transform.localEulerAngles.z; b > maxRot;) {
b -= Speed;
transform.localRotation = Quaternion.Euler (0, 0, b);
yield return null;
}
} else if (minRot < 0) {
for (float b = transform.localEulerAngles.z; b > maxRot + 360;) {
b -= Speed;
transform.localRotation = Quaternion.Euler (0, 0, b);
yield return null;
}
}
}
}
}


it works fine on pc,but when i run it in mobile,it seems that it runs so slow !!!

watch this video,it explains the problem.

in pc

in android(mobile)

what’s the problem???how can i fix it !!!

hey;
every time u want to add or do some thing with a variable u have to multiple it buy last time frame time;

like this :

b += Speed * Time.deltaTime;

u may need to modify the speed a little bit or increase it but
this way it works both the same at pc and android;