Guide to Unity's Animator Controller

Guides Guide to Unity's Animator Controller

This is a quick guide to demonstrate how to make a prefab in Unity that includes animation. In this guide we will create a goose that continually loops in an idle animation sequence. This same technique could apply to other prefabs and animations that you may have, such as ceiling fans, etc. Please find an example of something you have and follow along.

Step 1: Load the prefab of the object you want to animate. In this example, I have loaded the default goose (image below). Please note on the right inspector panel, it shows an animator component and there is a controller already assigned. We will see the inner workings of this default controller in the next step.
AC 1.jpg



Step 2: I have selected the Animator panel, circled below. Now we see how this default animator controller is organized. Often times, these default controllers will allow for every animation of the object, but to move from one animation to another a script would be needed to run on the object in the game. To simplify things to eventually port this to VAM, we will build our own animator controller with one specific animation in mind.
AC 2.jpg



Step 3: Find a folder in your Unity project where you want to create the animator controller. Right click the mouse button, then slide mouse cursor to "Create" and then go to "Animator Controller" and click the left mouse button to select. See image below as I am getting ready to click on "Animator Controller."
AC 3.jpg



Step 4: Name your animator controller (red circle) and then select it. Now in the Animator panel you will see your new controller, which always starts with Any State, Entry and Exit controls. Proceed to the next step.
AC 4.jpg



Step 5: Locate the animation that you would like to add to this controller. Animation icons are identified by the commonly recognized right pointing triangle. Left mouse click on this icon and while holding the mouse button down, slide it up to the animator panel above.
AC 5.jpg



Step 6: You will now see a box representing this animation in your animator controller (circled in red in the image below). Note that an orange arrow automatically connects from "Entry" to this animation. This is the first animation loaded to the controller, so by default, Unity assumes you want this to be the first animation. This works for us, so let's proceed to the next step.
AC 6.jpg



Step 7: Right click on the "swan goose idle" animation and a window will pop up, as shown in the image below. Left mouse click "Make Transition."
What "make transition" does is allow you to sequence from one animation to another. In this example, I just want this idle animation to keep repeating indefinitely. To do so, when I create the transition, I will left click on that same animation again, which basically causes an infinite loop. See the next step for what the display will look like after making the transition.
AC 7.jpg



Step 8: The image below shows the arrow, it is basically just pointing back to itself and creating an infinite loop. The right inspector panel confirms this, showing the transition going from idle to idle.
AC 8.jpg


Step 9: Now would be a good time to prepare for the new prefab. Let's give our prefab a new unique name, see left red circle. Let's also prepare to change to our newly created animator controller. The red circle on the right shows that at this moment, we still have a different controller, the default controller. Sometimes this section might also say "none" meaning that no controller is assigned. If you ever want to make a static pose for another project, just basically make sure that no controllers are assigned. But, that is for another day, let's proceed with our goose animation in the next step.
AC 9.jpg



Step 10: By this stage we have renamed the prefab. Make sure you have this prefab selected with the cursor and it is highlighted (see left red circle). Next, find the idle animator controller and slide that icon to the inspector panel for the animator controller (see red circle). By this point in the image below, we now have our newly created controller assigned. The next step is to check things out.
AC 10.jpg



Step 11: Next, left mouse click the swan goose idle box (center red circle) and then in the inspector panel left mouse click on the transitions going idle to idle (circle in the middle right of the inspector panel). Clicking on this will now show a preview image of the goose. If you click the play button near the goose image, it will show a preview of the animation, jumping from one idle sequence to the next. The small circle on the lower right highlights how Unity has automatically assigned an overlap to transition from one animation step to the next. Proceed to the next step.
AC 11.jpg



Step 12: Unity will usually assign a default overlap for the transition, sometimes the default works, sometimes it does not work well. You will know if you see any unnatural jumps in the animation, as if a frame was skipped. If this occurs you might need to make some adjustments in the transition settings. You will have to experiment with what settings work with your specific animation sequence. If it works by default, be happy.
AC 12.jpg



Lucky Step 13: When looping over and over again to the same animation, one technique that I have found that works well is to make 100 percent overlap as shown in the example image below (see right circled area). The blue areas shows that the overlap encompasses the entire length of the animation. The last step would be to save your prefab to your Unity project, so in this case I would create a new prefab in my Unity project and then select the swan goose idle prefab from the hierarchy panel (left circled area) and left mouse and hold, then drag to save to the new prefab.
AC 13.jpg



If you have any questions, please post to the discussion area, or feel free to send me a private message. I hope this helps.

Warm regards,
Farger
Author
Farger
Views
1,076
First release
Last update
Rating
5.00 star(s) 5 ratings

More resources from Farger

Latest reviews

Omg thank you! , I've been so curious about how people did this in vam, I asked the guy who made the gbanger scenes or whatever and he just ignored me. I have something to learn and play around with this weekend.
Farger
Farger
Sometimes it can be challenging to answer questions concerning Unity. I have been practicing making animator controllers for a number of resources lately, so I have the routine pretty much figured out. Thank you for the review and please let me know how it goes.
Upvote 0
brilliant guide mate. easy to follow and well explained for new unity users.
Farger
Farger
Thank you very much, your review lifts my spirits, I greatly appreciate it mate.
Upvote 1
Thank you for taking the time to create and share this guide!
Farger
Farger
Thank you for taking the time to express your appreciation. It is for people like you that I am inspired to contribute to the Hub.
Upvote 1
I can finally bring it back to life. Thanks.
Farger
Farger
I am so curious what it is now. Bride of Frankenstein? Just kidding, I am silly. Please let me know how it goes. Thank you for the review. ❤
Upvote 1
Static assets are dead assets. Now they can live!
Farger
Farger
Thank you reaching out and asking about this process.
Upvote 1
Back
Top Bottom