Add a Character

If you want to add or change a character, here's how:

1

Preparation

Before you begin, make sure that you have all the components needed:

  1. Import sprite sheets or sprites for character and it's animations, as listed below:

Idle Sprite Animation
Run/Walk Sprite Animation
Defeat Sprite Animation
Revive Sprite Animation
  1. Prepare these sprite sheets to be used for animating. If you need a reminder on how to do that, take a look at Unity Learn Documentation.

  2. Create Animation Controller and Animations from these sprite sheets. Visit Unity Learn Documentation to know more.

2

Character Prefab Creation

Now you can create a prefab for your character.

The easiest way to do this is to modify or copy existing prefab:

  1. Navigate to and select one of the character prefabs there. Open it, or make a copy.

  2. In the Inspector there will be 3 main components: Sprite Renderer, Animator and Character Behavior Script.

  3. In the Sprite Field of the Sprite Renderer assign a sprite from your character. By default it can be a simple standing pose.

  4. Make sure that the Material field of the same component has Player material assigned.

  5. Make sure that Sorting Layer is set to 0

Character Sprite Renderer example

If the sprite you assigned appears to be larger or smaller than expected, tweak its Pixel Per Unit value in the import settings.

  1. In the Animator Component, assign your Controller in the appropriate field.

Character Animator example
  1. In the Character Behavior script, assign the components needed.

If you did not add these components as new, and simply copied the prefab, they will be most likely assigned correctly by default.

Character Behavior example

3

Registering a Character

When you have your character prefabs ready, you need to register them.

However, if you modified existing characters instead of creating new one, you can skip the steps from 1 to 4.

  1. Navigate to the Characters Database at and open it.

  2. In the Inspector you will find several entries of the existing characters. It should look like this:

Characters Database example

Every entry has fixed fields:

Field
Description

Name

Character name that will display in the Character Selector

Cost

Amount of currency to unlock in the Character Selector

Icon

Preview image

Prefab

Link to the specific character prefab

Base HP

Initial health amount

Base Damage

Initial damage

  1. Press the Plus button below the list to create a new entry.

  2. Assign your character prefab to the according field.

  3. Populate all other fields to your liking.

4

Finish

Now you can start the game, and navigate to the Character Selector from the Main Menu to see your character.

Last updated