Unity 4.0 - Mecanim Animation Tutorial

Unity · 628K views · 2012 · 49:13

Open on YouTube

Game programming & enginesIndie game developmentComputer graphics & renderingtutorialdated

Why Game Development Stack Exchange recommends it

Game Development Stack Exchange answerers point people to it when asking how to get a rigged character animating in Unity, since it covers the whole Mecanim workflow in one place.

Recommended by 3 people across 4 different months, 2013 to 2015.

Why Stack Overflow recommends it

Stack Overflow users link it when answering Unity animation questions and want to steer people from the legacy Animation component to the Mecanim Animator state machine, including topics like masking.

Recommended by 5 people across 5 different months, 2013 to 2021.

What it is

An official Unity tutorial, nearly 50 minutes long, that walks through building animated characters with the Mecanim animation system introduced in Unity 4.0. A downloadable project folder lets viewers follow along step by step.

What people said

Recommends dome12b · 2013-06 · Stack Overflow · on “Getting MissingComponentException: There is no animation attached to the game object”

There are two ways in Unity 4 to call a model's animations. The "classic" way, like in Unity 3: By importing the fbx you have to set the "animation type" under "Rig" to "legacy." In the Hierachy the model needs the "Animation" component and NOT the "Animator" component! Then you have to add the animations from your model to the animation component. Now you can write animation.Play("Idle"); The "new" Mechanim way: By importing the fbx you have to set the "animation type" under "Rig" to "generic." In the Hierachy the model needs the "Animatior" component and NOT the "Animaton" component! Then you have to add the animations from your model to the animation controller, which you add to your Anim

Recommends Mikolaj Marcisz · 2013-07 · Game Development Stack Exchange · on “How to import character from Blender to Unity?”

I could make it a long answer but it would be a waste of time to write it, taking into consideration the fact that unity has made a great tutorial covering every step. [this video] Quick steps to animating a character: Watch the Mecanim tutorial video I would have never figured out how it works before trying to figure it out yourself and asking on any website. It is just 20 min for what you are asking, don't quit. Drag and drop the rigged character into the project folder Create a mecanim avatar for the character [LINK] Create an animation controller for your character The Mecanim 4.0 tutorial covers EVERYTHING (in 48 minutes)

Recommends Mrk Fldig · 2014-02 · Game Development Stack Exchange · on “Animations not accepted in animator”

Ok this can be a bit daunting but i'll run you through it. With the animator component you need to use the animator tab and switch between the different states via blend trees etc. Animator tab is here You create an Idle state and assign your idle animation as shown here: Now all you need to do is tell Mecanim to move between the difference states depending on what you're doing, in my controller script thats attached to my character when I press Forward or backward (Vertical axis 1 or -1) my code does the following(cut down for clarity): Note where I do anim.SetBool() that sets the variables you define in the animator which tell mecanim when to switch between the animations. void Start() { /

Recommends Aizen · 2015-06 · Stack Overflow · on “Delete animation of a certain bone for a number of frames Unity3d”

Comment is getting Bigger So I will paste it in here. [this video] In this video try to check the 44:51 ish or something. That is what you need. Then Control it with a script when to activate it. It is a Masking . You can mask the animation and so on. You will get the idea when you watch this.

Recommends Hash Buoy · 2015-10 · Game Development Stack Exchange · on “Matching collider to character mesh size in different postures”

Its best to handle collider scalling through mecanim system. Please refer to the following video. The guy adjusts the collider size according to the animation state. It covers the same problem which you are currently facing. [this video]

Recommends Hash Buoy · 2015-11 · Game Development Stack Exchange · on “How do I organize and sync multiple animated sprites in Unity2D?”

I think rather than having separate animations for each body part and then trying to sync the whole animation cycle. Its better to have one single animation for walk cycle where all the parts are moving in sync. And then add additional layers of animation on top of base layer which can override animation on some part of the body ex. waving hands while walking, nodding head etc. You can also use IK to get a specific result depending upon the environment. Follow these links you will get some idea [this video] [LINK] [LINK]

Recommends pointcache · 2017-01 · Stack Overflow · on “How do I Start/Stop an animation in Unity 5.3 (C#)”

While this doesn't directly answer your question, using direct commands to animation is a legacy functionality, nowadays we use Mekanim animation state machine: You can find a video tutorial here [this video]

Recommends V319 · 2017-08 · Stack Overflow · on “How can i get animator specific state length ? And how to make a loop to be infinity?”

Unity has newer and better way of animation handling called 'Mechanim'. Its much easier to use (especially when you need to mix two or more animations). It contains default 'Idle' state , so you just need to assign your animation to 'Idle' and mark your animation as 'Loop' in inspector window. I suggest you to take a look on the official video [this video]

Recommends TEEBQNE · 2021-05 · Stack Overflow · on “Where the Animator Avatar was taken from (Unity3d)”

It depends heavily on the character. Characters are made up of a lot of different parts to firstly exist (model, UV, texture) and then secondly to animate (bones, rig, animation). If the model you have is not rigged and you are asking this question, the work put in to rig a 3D model is more than I am thinking you can do right now. If this [LINK] is the asset you are talking about, it is animated and looks properly rigged. All an avatar in Unity is, is a way to map and configure bones of a character. I would read up on the Unity docs [LINK] about avatars. As long as the asset you have has the same bone structure for each animation, you can create a single avatar and re-use it. Due to the anim

Cites Sparkz63 · 2013-01 · Game Development Stack Exchange · on “Armature in Unity3d distorted”

Yes! That fixed the rigging! But... Unity3d still won't let me preview animations using this character, and trying to animate her using animations from link [this video] leads to a very strange yoga session. :/