3
\$\begingroup\$

I am trying to have 2 animations on one GameObject, and I want them to play at the same time. I have been looking all over and messing around with the animator controller, but I cant get it working.

How do you play more than one animation at a time in Unity?

\$\endgroup\$

3 Answers 3

3
\$\begingroup\$

I realize this question is a few months old, but it seemed wrong to leave it with no answers mentioning Animation Layers.

This is the standard way a Unity game would combine two different animations. (Here I'm assuming you're not trying to blend between similar animations, like different directions & speeds of walk/run, using a conventional blend tree or cross-fading transition)

There are two main ways to use layers:

  • An Override layer takes complete control of some parts of the object, and completely replaces the animation on those parts while letting the underlying animation continue to play on the rest.

    This is often done to separate upper & lower body animations, so the base layer handles all the walking/running/crouching animation for the legs and torso, and an override layer can take control of the arms to do things like holding & manipulating different objects.

  • An Additive layer stacks its animated movements on top of what the previous layers have produced. This gives you a bit less control over where exactly a body part ends up, since it's a result of two distinct animations.

    Additive layers are often used for aiming, or adding small tweaks and variations on top of a more robotic base layer to help it look more natural.

If you'd like more inspirations about ways to use animation layers to combine animations, I'd recommend checking out this GDC presentation about the animation of Drake in Uncharted I & II, which is where I first heard about additive animation.

\$\endgroup\$
-1
\$\begingroup\$

Are you using "Unity Mecanim" to play these animations, or are you using legacy? If you are using legacy, I don't think it is possible. With Mecanim you should be able to do something like this, even though I have never tried it. Just find some tutorials on it, and try and implement the thing you want to do. I would recommend this tutorial, I used it to get started with animating: https://www.youtube.com/watch?v=bvavLShgR90

\$\endgroup\$
1
  • 1
    \$\begingroup\$ "I don't know, maybe look at a tutorial?" is not a very helpful answer. Answers should always contain a solution to the problem (or at least a good explanation why a solution is unavailable/impractical) and not rely on outside links to do all the explaining (though using them for supplementary details is totally OK) \$\endgroup\$
    – DMGregory
    Aug 30, 2016 at 11:35
-2
\$\begingroup\$

So you want for example: Add an animation (change position) of a gameobject and while doing that: Add another animation(change rotation) the game object. (for example a car tire). right?

Or do you want to animate a child of a game object, while animating a game object? (for example: moving the forearm and moving the upper arm )? In both examples you should just do the animation in 1 animation. Mixing animations is not clean and also should not be necessary.

Just set the Keyframes with all of your game objects together . As long as you have parented them corrects, it should behave as planned.

Besides that: I agree with alexo1001. Unitiys standart mecanim "animation-maker" is pretty weak. I stumbled about tons of limitations while using it. I suggest you download other animation addon for unity.

\$\endgroup\$
3
  • \$\begingroup\$ Layering two or more animations is a fairly common practice in games (eg. Combining walking & aiming/throwing behaviours, where hand-keyframing every possible combination would be impractical), so the answer "just put it in one animation" is not very helpful. \$\endgroup\$
    – DMGregory
    Aug 30, 2016 at 11:32
  • \$\begingroup\$ as far as i understood, he does want his animations for "one Gameobject". Without children. Like a ball. and for example: combining the animations: rotate ball right + rotate ball left - which results in: no rotation , shouldnt be possible. At least not in the standart unity mecanim. \$\endgroup\$
    – OC_RaizW
    Aug 30, 2016 at 12:30
  • 1
    \$\begingroup\$ Even in that case it should be possible to use additive animation layers to combine two animation results. (And hey, who's to say "rotate left + rotate right = stop rotation" is not the asker's desired behaviour for this context?) \$\endgroup\$
    – DMGregory
    Aug 30, 2016 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .