【发布时间】:2016-05-13 13:08:00
【问题描述】:
我制作的剪辑由 1 帧 动画组成,有时效果不错,但有时连续播放或有时需要很长时间才能完成。当它连续播放时,我记录了它的时间,它保持为 0*(即使它工作正常也没有进展,然后它也保持为 0)*,而此剪辑的实际长度为 0.333354。
有什么问题?我在扯头发,为什么有时有效,有时无效。
gameObject.GetComponent<Animation>().Play("StartWait");
gameObject.GetComponent<Animation>()["StartWait"].speed = 25;
在签入更新时,它会持续播放或花费比预期更多的时间,即使 速度 很高而 时间保持为 0。
if (gameObject.GetComponent<Animation>().IsPlaying("StartWait")) {
Debug.Log(gameObject.name.Split('_')[1] + " startWait playing while speed :"
+ gameObject.GetComponent<Animation>()["StartWait"].speed + " and time :"
+ gameObject.GetComponent<Animation>()["StartWait"].time);
}
【问题讨论】:
-
我对 Unity3d 不熟悉。但是在经典的 c# 中,floating point deviations 可能是您遇到麻烦的原因,因为您正在以“非常高”的速度处理非常精确的数字。
-
如果将速度设置为 0,那么它有时也无法正常工作
-
如何检查游戏对象是否完整?