Need to Loop the Sprite Animation of a Child Object.

The more time I spend in Unity’s 2D animation system, the more my teeth hurt.

I have a parent sprite, it has a 12 frame Sprite animation. It has a child object (tail) which has only a 3 frame sprite animation. The parent object runs it’s 12 frame timeline, but the child only animated for its 3 frames. It appears there is no way to get the tail to loop without copying and pasting the 3 keys to fill the 12 frames of the parent. This can’t be correct.

I can’t find the ‘expected’ loop, or ping pong settings for Sprite objects. Anyone have a clue?

So I gather there is no way to loop a child 2D sprite’s animation if it is shorter than it’s parents?
Well, that’s a drag.

Could you not extend the shorter animation to the length of the longer one? From the looks of your screenshot it seems you are editing a single animation which would only loop after it ends on the last frame.

Of course. But that is a seriously weak option. Granted the 2D tools are v1, but wow…not being able to loop? a 3 position(keyframe) tail should not need to have it’s keys copied and pasted to the length of the parent animation. Can you imagine if it were like that in Maya or any other 3D or 2D animation program? Really hope the tool set matures quickly. It has such promise, but it’s missing some real core functionality.

Of course you can. You just nest it in the parent. The child’s loop/timeline will be independent of the parent.

I guess you mean the child has its own Animator - is there a good way to synchronize the animation states, so the parent and child play their corresponding clips together?

There appears to be no option to loop/ping pong a 2Dsprite’s animation. They are handled by Unity differently. I guess you could create the objects as separate sprites, with separate animation files, and parent them. but having the children’s curves there under the parent all visible together in the Animator seems like the way it was intended to work and a Whole lot more efficient for animating and tweaking the timing. Can you imagine timing out the children on an object if you had to click them all separately and recall the timing on a fair # of separate animation timelines?

1477115--81555--$Screen Shot 2014-01-08 at 10.54.55 AM.png

Yup that’s how you do it. Though you don’t have to do it for every thing, just the elements that you want. If you want an element to loop or do something independently of a main timeline, you nest it with its own timeline. (blinking eyes, wagging tail, etc.). But you can still animate the animated element on the parent timeline as well. It is a very efficient way to do it. The thing to bear in mind is that you want to limit your nested clips to simple loops that don’t have to sync with the parent.

But that is your goal, right? You want the tail to play a short loop over and over, despite the timeline of the parent. So by nesting it you get that loop, but you can still animate the clip on the parent. That way you get the benefit of inheriting parent attributes as well. Say you want to squash/stretch or scale the whole fish, the tail will inherit those transforms and still keep looping.

Unity’s approach is actually quite powerful and elegant. You can get pretty complex with the Animator and blend trees to do a lot of fun and pretty efficient stuff. For example, on one that I am working on now, the characters have a variety of expressions. So the head is a nested clip. The eyes are nested in the head. They blink at their own rate. At the top I can change the expression to “mad”. Using triggers, the “mad” eyes will keep blinking, but when the character gets hit, they winch and close based on a key in the primary timeline. I doesn’t matter which expression I have on the character, the trigger will wince the eyes at the right time in any of the expressions. It’s a little tricky to wrap your head around at first, but once you get it, it really makes things fast and efficient.

Sadly, I have had to deal with worse. some tools don’t let you nest in a practical way. For the Human Torch in Marvel Avengers Alliance, I couldn’t use nested clips due to our toolset. He has about 900 frames of primary animation, which, among other things, had about 30 separate fire elements that were 8 frame loops each. Everything had to be on one timeline. Over 16k hand placed keys. It sucked. A lot. Had we used Unity and nested clips, it would have been a breeze.

Thanks for sharing your experience with UT’s 2D animation tools. I had been avoiding adding separate timelines to elements then parenting them. It seemed cleaner to parent the unanimated sprites, then go under the ‘Add Curves’ option and add whatever needed, like Enable Sprite, or Rotation… I think I’m spoiled as my primary animation tool is Maya and the Curve editor is pretty open.

As for your recounting of the fun you had working on Marvel AA…that sounds brutal. Did you use separate sprites for the eyes (blink vs winch)? I as I understand it, we can’t current;y swap out Atlas’ dynamically. Like if you had multiple characters with the exact same animation, it would need to be created for each. I may be wrong with that, but it was mentioned in a video clip done by Prime31 giving a quick demo of their own version of the Unity 2d Character Controller.

I guess I am spoiled with 2DTK. But I was forcing myself to implement native stuff for a simple demo of these characters that are heading for the asset
store.

best,
B.

That makes sense. For me, most of my experience is in 2d tools like Flash and some others. So the single timeline/nesting/etc seemed very natural and what I am used to. The curves are new to me. :wink:

Those were actually two separate projects, I didn’t clarify that. The Marvel one is all flat, nothing nested. Flash was used as the animation tool with some custom conversion tools I built. It uses a lot of static poses so it is actually somewhere between rigged and frame by frame. None of those shared anything at all. It really wasn’t too bad generally, only Human Torch and Whiplash were real problems. There are a couple coming up that were bit rough too. Still, not a bad way to spend the day, animating superheroes. :wink: I have a love/hate relationship with animation. When things are smooth, it is one of the most enjoyable parts of my work. When it is tedious or there are problems or constraints it is worst part of my day. Never seems to be a middle ground. :wink:

The with the eye blinking and nested clips, that is something different, it is built in Unity, which makes many things much smoother. For those elements, yes they are separate animations that called and/or sprites turned on and off.

As for the shared animations…, I think you are right that is not the intended work flow… HOWEVER, you can do it. I have about 8 completely separate creatures that share roughly 80% of the anims. For the ones that I couldn’t share (longer arms, different tails, etc), I was still able to avoid starting from scratch by duplicating the .anim in the project window and assigned it in the animator.

The trick to making getting it work, is that the parts have to be named the same. Anything that is controlled by the animator has to have the same name in the hierarchy. So at the top (where the animator is assigned), I have “Character”, and everything is just named by it’s part “Body”, “Head”, etc. If you have extra parts or missing parts, it will fail, the structure needs to be the same. And of course this means that if you change it in any place, it will affect all the others as well. So far it has worked out fine. I have screwed up a couple of times by forgetting to to duplicate if I needed to modify an anim.

As you said before, it is a first release. I would love to be able to simply duplicate an anim and reassign the part names, the copy/pasting of keys is pretty wonky, minor things like that. Most of the useful stuff is all there, hopefully it will get more polished over time.

Cheers.