【问题标题】:One Frame clip sometime play continuously一帧剪辑有时会连续播放
【发布时间】: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,那么它有时也无法正常工作
  • 如何检查游戏对象是否完整?

标签: c# animation unity3d


【解决方案1】:

问题与动画对象的剔除有关。动画对象远离我相机的视口,这就是动画连续播放的原因。

当动画剔除类型选择为BasedOnRenderers 时,动画将被禁用。 更多信息请参考问题Animation clip taking unexpectedly long time to finish

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多