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 !!!