Creating Reusable Characters With Blender and Unity
Characters in video games are often as memorable as the accompanying gameplay and music. In this tutorial, you’ll learn how to prepare a humanoid model using Blender and how to bring it into Unity. By Eric Van de Kerckhove.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Creating Reusable Characters With Blender and Unity
40 mins
Artists create 3D characters for your favorite games with the use of models, textures and animations.
In the past, characters needed to have the exact same skeleton to share animations. This limited character diversity as their height and proportions had to be the same as well. As an amusing example, the older FIFA games had players all be the same size because creating a separate skeleton — and a set of animations — would have been a nightmare.
Nowadays, most game engines come with a system to allow reusing animations as long as the skeletal hierarchy is compatible. This allows you to use the same animations for characters of all shapes and sizes. In Unity, this system is called Mecanim. It allows for easy set up of animations, the blending between them and retargeting of humanoid animations between models.
Being able to reuse animations allows you to use animations from the asset store and websites like mixamo.com for your own custom characters. This saves a ton of time!
In this tutorial, you’ll learn how to prepare a humanoid model using Blender and how to bring it into Unity. More specifically, you’ll learn how to:
- Create an armature (skeleton) for a character and rig it
- Enhance the character with accessories and objects
- Export a model to FBX
- Import Blender models into Unity
- Create and tweak a humanoid avatar
- Attach objects to a character
- Animate a humanoid in Unity
Time to jump right in!
Getting Started
Before you begin, verify you meet the following requirements:
- You’ve downloaded and installed the latest 2020.3 LTS release of Unity.
- The latest stable 64-bit version of Blender is installed on your machine.
- You have a minimal understanding of the Unity editor. Check out some of the beginner tutorials on the website.
- Some experience with Blender is recommended. Here is a good tutorial to get started.
Download the source materials by clicking the link at the top or bottom of this tutorial and unzip it somewhere.
Open the Starter folder and navigate to the Assets\RW\Models folder. Now open CuteCharacter.blend in Blender.
The file contains the following:
- A low poly humanoid character model
- The CuteCharacter material
- A reference to the CuteBase texture contained in the same folder as the model
After opening the file, you should see the character model on the left:
Note that it’s mirrored on the X-axis, meaning its left and right side are identical. This will make the whole process a lot easier along the way.
The right side of Blender has a simple texture image loaded:
Time to get to work! The first step to animating this character is rigging it.
Rigging the Character
Rigging is the art of creating an armature, the skeleton of the model. An armature has bones to which you can connect vertices, so they move along whenever a bone gets moved around.
Hover over the 3D View to bring it into focus. Now add a new armature by holding Shift and pressing A to open the Add Menu. Next, select Armature to add the first bone.
You’ve now created the armature and its first bone, also known as the “root bone”. With the armature still selected, find the In Front check box in the Viewport Display section of the Object Properties tab and check it.
The armature is now visible through the character making the skeleton creation process a lot easier.
Before diving in and creating the full skeletal structure, it’s important to understand how it needs to be set up to be compatible with Unity’s Humanoid Avatar.
Due to the way Unity maps the bones to its own system, some key bones are necessary.
Unity expects at least 15 bones, which are:
- Hips (root bone)
- Lower spine
- Upper spine
- Neck
- Head
- Two upper arms
- Two lower arms
- Two hands
- Two upper legs
- Two lower legs
The rig you’ll be creating includes all of the above bones and some extra ones for added stability when animating.
Make sure the armature is still selected and press Tab to enter Edit mode. Next, select the root bone by clicking it.
Now open the Bone Properties tab on the right in the Properties editor and rename the root bone to Hips by entering it in the name field and pressing Enter.
Spine
With the first bone made, you can now transform it into a spine for the character.
Select the bottom, sphere shaped connector of the Hips bone. Next, press G, Z, 0.5 and Enter in sequence to move it up around where you’d expect the center of the hips to be.
Now, select the top connector and press G, Z, 0.1 and Enter to move it up a bit.
To get more spine bones, you’ll need to subdivide the Hips bone in three pieces. Select the Hips bone, right-click to open the context menu and select Subdivide. By default, this makes a single cut, splitting the bone into two pieces. To increase the number of cuts, open the Subdivide menu at the bottom left of the 3D view and set Number of Cuts to 2.
With the spine split, the new bones are named Hips.001 and Hips.002. That’s not a good way of naming bones; rename the bones by selecting each one and changing the name in the Bone Properties tab of the Properties editor on the right like you did with the Hips bone.
Name the top one Chest and the middle one LowerSpine.
Legs
Next up are the leg bones. Duplicate the Hips bone by selecting it and then pressing Shift + D. Next, move it a tad to the right and right-click at the end to reset the position of the new bone.
If you look at the Bone Properties tab on the right, you’ll see a bone named Hips.001 selected.
Rename this bone to UpperLeg.L. The L stands for left, this makes it clear what side the bone is on and will help with mirroring later on.
This bone needs to point down and be placed right above the knee. To start off, rotate the UpperLeg.L bone 180 degrees on the Y axis by pressing R, Y, 180 and Enter in succession.
Now move it in place horizontally by pressing G, X, .23 and Enter in that order. After that, press G, Z, -.2 and Enter to get it in position vertically.
Select the bottom connector and move it down by pressing G, Z, -.3 and Enter in that order.
You now have one large bone for a leg. If this character had wooden peg legs, this would’ve been perfect already! Most people have knees so they can bend their legs though, so you’ll need to make it bendable.
To do that, select the UpperLeg.L bone, right-click and select Subdivide to split the leg in two (ouch!). This results in two leg bones with a connector in the middle that will act a knee. Go ahead and the new bottom bone LowerLeg.L.
The last part of the legs are the feet. Switch to a side view by pressing 3 on your numpad and press period (.) on your numpad to focus on the lower leg.
Now select the bottom connector and extend it to make a foot bone by pressing E, Y, -.18 and Enter.
Next, rename the newly created bone to Foot.L using the Bone Properties tab.
Now might be a good time to save the file. Press CTRL + S and you’ll notice a small notice appearing at the bottom of the window. Feel free to do this periodically, better safe than sorry!
Switch back to the front view by pressing 1 on your numpad. Before moving on to the head, you’ll need to parent the leg to the hips. Luckily this is pretty simple!
Select UpperLeg.L and expand the Relations section of the Bone Properties tab. Click on the Parent drop-down and select Hips.