The mesh object should now be finished. (See part 1.)
Open the project with your mesh character (or append the mesh object into a new project). It's a good idea to save the project with the mesh character under a new name so you easily can go back and reuse the mesh to develop it in some other way. To do so, open project and choose save as with a new name.
Note: Also, later on, keep a copy of the project file with your finished metarig so you can go back and create a rigify version of it later if you need. More on rigify in part 3.
Using the mesh character from Part 1. Our character is already in a T-pose which is good, this pose is often used as a start pose for rigged characters. Name your mesh object to something meaningful for you. Make sure you have enabled the Add-on Rigging: Rigify. (Otherwise you can reach this from Edit - Preferences.)
About bone definitions:
It's worth noticing the usual definitions of the bones in the rig, the thick base is called the root or head, the thin top side is called the tip or tail. The part between rot and tip is called the body of the bone.
Creating a metarig
In Object mode, go to menu Add - Armature - Human (Meta-Rig)
With metarig object selected, tab to Edit mode. Turn on X-Ray to see the contours of your mesh. You can also use Wireframe mode to see better.
Set pivot to 3D Cursor. The cursor should be at zero position.
In Edit mode, scale the rig to fit the character's size. We'll need to adjust the proportions, so let's start with selecting all of the rig with A. Scale down so the pelvis is in the right place. Deselect the bones from the pelvis and downwards.
Scale up again until the lower part of the bone (the root) above pelvis (spine.001) is around the part of the spine that bends inwards, the lumbar spine area.
You can also adjust the edge loops later on the character to match this area for best results.
Deselect spine.001 and continue scaling, let spine.002 be around the upper area of the spine that bends, (around the level of the armpits or lower part of the Sternum).
Deselect the bones up until spine.004, scale up so spine.005 starts at the beginning of the head part.
To scale sideways, set Pivot to Median point. Select the arms up to the shoulder joint. Press S and X, to scale on x axis. Adjust the bones by scaling (S) or moving (G) until they fit inside the mesh in the right places. Be careful not to separate any of the spine bones, move the tail and head together as some bones need to be perfectly aligned.
For some adjustments, such as rotation, it can be easier to select one part, for example a part of the arm, then check the X-Axis Mirror in the Tool tab on the Sidebar.
Don't forget to turn it off when you don't need it.
Go to Object mode and select the mesh object ("in this example it is still named Cube"), then select Edit mode and make minor adjustments if needed. (Avoid making any changes to the mesh after you have added it to the armature rig.)
In this example, I'm going to raise the loops at the armpits a bit upwards.
Remove bones that you don't need for your mesh.
A note about face bones: If you are keeping face bones, you may need to upgrade the Face Rig. Look at Object Data Properties for the metarig (when selected the little green figure down to the left). Under Rigify it may be a note that says "This metarig uses the old face rig", click on Upgrade Face Rig. You need to do this before you Generate a Rig.
Some bones won't be needed for this example, but you could save a version of the project or object before you remove the bones. Then you could always go back and continue editing on the mesh if you need to use the facial and hand bones for another character.
To remove facial bones, expand the structure of the metarig in the Outliner. For a quick unfold of all the bones, hold shift and click on the expand arrow.
In 3D Viewport window and x-ray mode, make a rough circle select of the whole face, check the outliner and unselect any spine bone that might have been selected. (Shift and rightclick to unfold the whole metarig hierarchy.) You can unselect in Outliner by holding Cntrl and click twice. For this case we can delete all bones from face and down. Press Delete, select Bones.
For this character, we only need upper arm, forearm and hands. So, we can make a rough selection of the hands area and remove everything below the bones hand.L and hand.R. We can also remove breast bones, and the top bone, spine.006.
Select the tip (tail) of the spine.005 and move it on z axis so it covers the whole head.
Check from top view and side view if the bones needs further alignment and you can make some adjustments on the mesh where you like.
Here I'm inserting one more loop on each arm between the elbow and shoulder joint with a factor around 0.7. From top view (num pad 7), the mesh elbows and elbow bone joints could be moved slightly back on the y-axis.
Now we can save the project and continue with preparing the rig and mesh for Unity, and if we like, create a simple animation before we export the character and animation to Unity.
Prepare rig for Unity
To prepare the rig and mesh for Unity's scale and coordinate system we can change the scale and rotation of the rig and mesh. It is not totally necessary but can make things easier in Unity.
Select the metarig in Object mode. Press S for Scale, type 100, confirm with mouse click. Menu Object - Apply Scale. Press S again, now type 0.01, confirm. (The metarig should now have the scale 0.010.
On the X Rotation, type -90. Menu Object - Apply Rotation. Rotate back to 90.
Do the same with the mesh object, set scale to 100, apply, scale back 0.01. Set rotation on x -90, apply and rotate back 90.
After this you can parent the mesh to the Armature rig and set the weights (the latter is how much a bone should affect a vertex group).
In Outliner Window, with mesh object selected.
Cntrl click on metarig (mesh obj should be orange, metarig yellow (the yellow one is going to be the parent), this color marking is visible both in Ouliner window and in viewport.
Menu Object - Parent - Armature Deform - With Automatic Weights
If you should take a look at the mesh now in Weight mode, you should see that it has got a vertex group for each bone and colored areas for each of those groups.
(Now may be a good time to name the mesh to something suitable if you haven't already.)
You could export the rigged character now as an FBX file without creating any animation but in this example we are going to create a simple animation first.
Create an animation, action clip
With metarig selected, choose workspace Animation. This should take you to Pose Mode.
In Blender, the animation clips are called an Action. You create the animations by setting keyframes for bones in specific postions over time (viewed in the timeline). You can create several actions. In this example I'm going to create a very simple Wave action/animation.
A little about FK, IK and keyframes. In the example I'm often inserting keyframes for the whole character (instead of just specific bones) this often helps when working with IK. You can think of FK as a way of moving arm- and legjoints on a LEGO figure, while in IK you're moving the arms and legs on a puppet that has strings connected to the feet and hands.
In Object mode with metarig selected, go to Anmation workspace, this should take you to Pose Mode. Press Wireframe icon as viewport shading.
Here you can select all or individual bones, as selected they turn blue.
The window below is Dope Sheet with default editing context Dope Sheet, I recommend here to choose Action Editor as editing context.
Press Auto Keying button (the rec button on the play bar).
Animate your character as you want it or follow the video example.
Exporting the rig to Unity
Select both metarig and mesh object, go to menu File - Export - FBX.
On the right side of export window, next to Limit to, check "Selected Objects", click on Armature, shift click Mesh. (Meaning you choose to include only the selected Armature and mesh in your fbx file.)
Scroll down, under Armature, deselect "Add Leaf Bones".
Name your file to something meaningful then press Export FBX
Importing the rig and animation to Unity
In Unity, under Assets, create a folder or go to one you already have, where you want to place your fbx model. Right click and choose "Import New Asset". Locate your saved fbx model and press Import.
In Unity's Inspector you should now be looking at the Import Settings. Under the Rig tab, select Humanoid under Animation Type, click on Apply. You should now be able to check the Configure settings by pressing button "Configure". If all went well, all bones should now be mapped and marked green. Click Done at the bottom. (You can also leave the preview by clicking on the leftmost arrow next to "Avatar Configuration".
Drag your fbx model into the scene and try out some animation.
There should be an Animator component attached to your object. An Avatar should've been created at the import. You also need to create an Animator Controller or use an already existing one.