【发布时间】:2016-07-08 11:43:34
【问题描述】:
我想通过更改 RawImage 的 uvRect.y 来为纹理设置动画。
public class animation : MonoBehaviour {
public RawImage image;
public Text text;
private Rect rect;
// Use this for initialization
void Start () {
Application.targetFrameRate = 60;
rect = image.uvRect;
}
// Update is called once per frame
void FixedUpdate () {
rect.y += (Time.fixedDeltaTime*0.1f);
text.text = (Time.fixedDeltaTime * 0.1f).ToString() + " : " + Time.fixedDeltaTime + " : "+image.uvRect.y;
image.uvRect = rect;
}
}
在 Unity 的编辑器中动画很流畅,但在设备(iOS 或 Android)上却不是。 场景中没有其他脚本,所以 CPU 没有加载太多导致动画不流畅。
那么为什么会这样以及如何解决呢?
【问题讨论】: