- Home /
Animation won't play after marked as legacy
Hi. I created an animation using a sprite sheet. It's a "puff of smoke" that plays during a teleport. The script does a yieldforseconds that gets the length of the animation.
yield return new WaitForSeconds(animation["EyeTeleport"].length);
My problem is that if I leave the animation as it is (not legacy), the animation plays properly but my script breaks on a nullexception/getref error in an IEnumerator function. In other words, the puff of smoke happens, but the object does not teleport.
Since the editor is saying "mark it legacy", I do so. And now the script works perfectly. The object teleports after the right amount of time. However, the animation will not play.
Obviously, I would like both things to work, and I am hoping someone can help me get this figured out. Thanks!
im not to sure about this, but i always thought that animations are either one or the other. and are exported as such, so if its legacy then it requires animation to be legacy and visa versa. so switching wont work.
$$anonymous$$aybe someone more experienced in animation can answer, cos maybe my knowledge is wrong :)
Could you post the script you are using? and also the inspector screenshot for animation?
Definitely! :) Thanks for the offers of help! :)
Here is a link to a video of the game in action: http://youtu.be/9X5TIjHC97w
And here is my teleport code. It should be clear since my scripting skills aren't very advanced, but... I find any game object tagged Target1, and then check what level is active. If it's level 5, then I set bAnimatingEye to true (so that the player cannot move while the "goal" is moving. I then play the animation for the puff of smoke, wait until it's done, teleport the eye, then play another puff of smoke to hide the pop-in.
IEnumerator $$anonymous$$akeTheEye$$anonymous$$ove()
{
if (gameObject.tag == "Target1")
{
LineTest CheckLOS = (LineTest)Target.GetComponent(typeof(LineTest));
if (LineTest.sCurrentLevel == "Puzzle_Level05")
{
bAnimatingEye = true;
CheckLOS.LineOfSight();
anim.Play("EyeTeleport");
yield return new WaitForSeconds(animation["EyeTeleport"].length);
EyeLocation.position = new Vector3(-10.5f, 12.55f, -10f);
anim.Play("EyeTeleport");
yield return new WaitForSeconds(animation["EyeTeleport"].length);
bAnimatingEye = false;
LineTest.iSeeYou--;
CheckLOS.LineOfSight();
}
}
else{}
}
FRAPs would not record my entire desktop, but in the Animator window, you can see that my EyeIdle clip is playing (it's a blank clip). When the eye is teleporting, it shows that the EyeTeleport clip IS playing. However, as you can tell by the clip, you can't SEE anything happening. Nothing appears in the console at all. It's blank throughout.
And here's a screenshot of my inspector for the animation:
And here's a screenshot of my animator/animation windows:
If I can provide anything else to make this clear, let me know! :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613152914im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Animation frames are jittery 2 Answers
Replace Sprite Sheet that's Already Animted? 0 Answers
Performance question - Animations in spritesheet vs animation in Mecanim? 0 Answers
Performance question 1 Answer