> For the complete documentation index, see [llms.txt](https://dante-3.gitbook.io/dante-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dante-3.gitbook.io/dante-docs/modular-experience-system/modular-experience-manager-component/lifecycle.md).

# Lifecycle

### Load State Machine

```
Unloaded → Loading → LoadingParentChain → ExecutingActions → Loaded → Deactivating
```

| State                | Description                                                |
| -------------------- | ---------------------------------------------------------- |
| `Unloaded`           | No experience loaded yet. Auto-resolve runs at BeginPlay   |
| `Loading`            | Asset bundle is loading asynchronously                     |
| `LoadingParentChain` | Parent experiences are being loaded recursively            |
| `ExecutingActions`   | Actions in the chain are being activated from root to leaf |
| `Loaded`             | All actions are active. `OnExperienceLoaded` has fired     |
| `Deactivating`       | Actions are being deactivated in reverse order at EndPlay  |

### BeginPlay Behavior

{% stepper %}
{% step %}

### Step 1

When `BeginPlay()` is called, if the state is still `Unloaded`, an authority check is performed (`GetOwner()->HasAuthority()`).
{% endstep %}

{% step %}

### Step 2

`TryAutoResolveExperience()` is called.
{% endstep %}

{% step %}

### Step 3

The experience is searched for sequentially from these sources:

* `UMES_DeveloperSettings::ExperienceOverride` (editor only)
* URL Options (`?Experience=...`)
* CommandLine arguments
* `AMES_WorldSettings::DefaultGameplayExperience`
  {% endstep %}

{% step %}

### Step 4

`ChangeCurrentExperience()` is called with the found experience.
{% endstep %}
{% endstepper %}

> **Note:** In Auto Setup mode, this component can be dynamically added to the GameState by `UModularExperienceSubsystem`.
