Build the character
Assets/
Scenes/
Arena.unity
Scripts/
Prefabs/
Models/
you already havethis lesson adds
Open Arena.unity from tab 01. You have three capsules standing on the floor — Knight, Mage and Archer — and keys 1 / 2 / 3 switch between them. Everything in this tab happens to the Knight.
Mage and Archer stay as capsules the whole way through. Keeping them is deliberate: at the end of every lesson you can press 2 and see, side by side, exactly how much the Knight has gained.
A game character is four layers on one GameObject: a model to look at, a rig to animate, an Animator to choose clips, and a collider to bump into the world.
Model, rig, Animator, controller — you need all four before the character can walk.
Where to get a character
Mixamo (free, Adobe account): pick a character, pick animations, download as FBX. Fastest possible start.
Unity Asset Store: search 'free character' and filter by price 0.
Or keep the Knight capsule from tab 01 — every script below works on a capsule too, and you can drop the model in later.
Import settings that matter
- 1
Drag the .fbx into Assets/Models. Select it, open the Rig tab.
- 2
Animation Type → Humanoid, then Apply. This maps the model's bones onto Unity's standard skeleton.
- 3
Humanoid means any Mixamo animation works on any Mixamo character — clips become interchangeable.
- 4
On the Materials tab choose Extract Textures / Extract Materials so you can edit them.
Assemble the character object
- 1
Select Knight in the Hierarchy. Remove the capsule's MeshFilter, MeshRenderer and Capsule Collider — the Character Controller below replaces the collider — but keep the GameObject and its name.
- 2
Drag the model in as a child of Knight, at local position 0, 0, 0. The parent keeps its name, its scripts and its place in the switcher list.
- 3
On the Knight itself, add .
- 4
Set Height 1.8, Radius 0.3, Center Y 0.9 so the capsule wraps the body with the feet at Y = 0. Then set Knight's Position Y back to 0 — the collider does the lifting now, not the transform.
- 5
Create an empty child called CameraTarget at Y = 1.5 — the camera will aim there, not at the feet. Tab 03 needs it.
- 6
Finally drag Knight into Assets/Prefabs. From here on it is a prefab — the Knight is saved as a file of its own, not only as an object in this scene.
CharacterController or Rigidbody?
✓ CharacterController
✓ Rigidbody
A stats component to build on
using UnityEngine;
public class CharacterStats : MonoBehaviour
{
[Header("Base")]
public float maxHealth = 100f;
public float attack = 20f;
public float defense = 10f;
public float moveSpeed = 5f;
[Header("Runtime")]
public float currentHealth;
public bool IsAlive => currentHealth > 0f;
void Awake()
{
currentHealth = maxHealth;
}
public void TakeDamage(float rawDamage)
{
if (!IsAlive) return;
float reduced = Mathf.Max(1f, rawDamage - defense); // always at least 1
currentHealth = Mathf.Max(0f, currentHealth - reduced);
if (!IsAlive) Die();
}
void Die()
{
Debug.Log(name + " died");
// animator.SetTrigger("Die"); next lesson
}
}