> For the complete documentation index, see [llms.txt](https://docs.sparkframework.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sparkframework.dev/documentation/developer-guide/core-systems/characters/api.md).

# API

**Assembly:** `Spark.Character` **Interface:** `ICharacterPlugin` **Implementation:** `CharacterPlugin`

## Interface

```csharp
public interface ICharacterPlugin
{
    List<CharacterEntry> GetAllCharacterEntries();
    CharacterEntry GetCharacterEntry(string characterId);
    bool HasCharacterEntry(string characterId);
}
```

## Methods

### GetAllCharacterEntries

```csharp
List<CharacterEntry> GetAllCharacterEntries()
```

Returns all character entries in the database.

### GetCharacterEntry

```csharp
CharacterEntry GetCharacterEntry(string characterId)
```

Returns the character entry with the given ID, or `null` if not found.

### HasCharacterEntry

```csharp
bool HasCharacterEntry(string characterId)
```

Returns `true` if a character entry with the given ID exists.

## CharacterEntry

Inherits from `SparkDatabaseEntry`. Defines a character template.

Standard fields inherited from `SparkDatabaseEntry`:

* `id` (string): Unique identifier
* `entryName` (string): Internal name
* `displayName` (string): Player-facing name
* `description` (string): Player-facing description
* `icon` (Sprite): Character portrait/icon

The Character entry is intentionally minimal. Character depth comes from extensions added by other plugins (Combat stats, Progression, Items, etc.).

## Components

### CharacterEntity

MonoBehaviour that links a scene GameObject to a `CharacterEntry`.

```csharp
// Attach to a GameObject with SparkEntity
public class CharacterEntity : MonoBehaviour
{
    // Set in inspector: reference to the character entry
    // Provides runtime access to character data
}
```

### PlayerAvatarEntity

MonoBehaviour that marks an entity as the local player character. Registers with `SparkEntityRegistry` as the player entity.

## Save Data

| Class                           | Description                              |
| ------------------------------- | ---------------------------------------- |
| `CharacterSaveData`             | Stores character state for persistence   |
| `CharacterSaveDataRegistration` | Registers save/load with the Save plugin |

## Usage

```csharp
var charPlugin = Spark.GetPlugin<ICharacterPlugin>();
if (charPlugin != null)
{
    CharacterEntry entry = charPlugin.GetCharacterEntry("warrior_01");
    Debug.Log($"Character: {entry.DisplayName}");

    List<CharacterEntry> all = charPlugin.GetAllCharacterEntries();
    Debug.Log($"Total characters: {all.Count}");
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sparkframework.dev/documentation/developer-guide/core-systems/characters/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
