I’m doing something very simple. I have an animation. At specific points on the timeline I have added some events.
At these points, I want the animation to pause, then wait for user interaction before continuing either forwards or backwards in the timeline.
Here’s the code to pause:
I’m doin exactly as the situation describes… and this is the error…also all the events in my anim get messed up and trigger at the wrong timings…
Abs(14.350000 - 14.420706) <= 0.050494
0.070706 <= 0.050494
2.021127e-002 <= 0
Same error. It doesn’t seem to affect how my game plays, but it does slightly slow it down, so it’s annoying, but not game-breaking.
Code:
using UnityEngine;
using System.Collections;
public class FireFlipper1 : MonoBehaviour {
bool fired;
public string Command;
public int speed;
public string anime;
//int timeAdjustment;
// Use this for initialization
void Start () {
fired=false;
//timeAdjustment=0;
}
// Update is called once per frame
void Update () {
if (Input.GetAxis(Command)>0 !fired)
{
animation[anime].speed = speed;
animation.Play(anime);
fired=true;
}
// if (animation[anime].time>=animation[anime].length)
// fired=true;
else if (Input.GetAxis(Command)<=0)
{
if (fired animation[anime].time==0)
animation[anime].time=animation[anime].length;
animation[anime].speed = speed*-1;
animation.Play(anime);
fired=false;
}
// fired (animation[anime].time==0 ||
// animation[anime].time==animation[anime].length+timeAdjustment))
}
}
This post is 7 years old (edit: 9 years, actually) but the bug still occures in 2018.4.0f1 and this is the top google result.
To reproduce the bug, you have to create an animation with wrap mode loop and with an event at 0:00 that calls a method in which the animation speed is set to zero.
My workaround was changing the animation event to trigger at 0:01 ms.