# Respawner

## Overview

This component is in charge of Spawning the Player Animal back into the scene after he is death.

<figure><img src="/files/yvf8jlWOkpzD7ZDUAMzI" alt=""><figcaption></figcaption></figure>

If no Player is assigned it will search for the Animal that has the Player option enabled:

<figure><img src="/files/7MhwQ1O1Grptjad3VVNk" alt=""><figcaption></figcaption></figure>

It will listen to the States this character has, and if the character activates **Death** State it will Restart the scene.&#x20;

If the Player parameter set is a Prefab it will instantiate it on the Respawn point.

This component works along with the CheckPoint component. If an animal enters a checkpoint the Respawner will move to that Checkpoint position and it will store the last State the animal use on that checkpoint.

## Parameters

### Player

&#x20;Reference for the Animal Player. If this parameter is empty the Respawner will find the Player Animal on the scene Using MAnimal.MainAnimal.&#x20;

You can assign a Prefab here, without having an animal on the scene, this Animal Prefab will be instantiated on Start.

### Respawn Point

Position to instantiate the animal. Usually is set to the same GameObject that has this component

### Respawn State

State on which the Animal will be respawned. This value by default is Idle. When an animal interacts with a **CheckPoint**, the Last State that the animal had before entering the checkpoint.

### Respawn Time

Time needed to restart the game or respawn the animal, after the animal died.

### Destroy After Respawn

If the Player is a Prefab. It will leave behind the Death Animal mesh. Set true this parameter to remove the dead character.

### On Restart Game

Invoked when the Scene is restarted.


---

# Agent Instructions: 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:

```
GET https://malbersanimations.gitbook.io/animal-controller/secondary-components/respawner.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
