> For the complete documentation index, see [llms.txt](https://sebun1.gitbook.io/skins/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sebun1.gitbook.io/skins/schema/initialization.md).

# Initialization

How the plugin is initialized at Runtime

The Skins plugin goes through a series of steps to load all the used assets. There are two processes involved through the lifecycle of the game:

1. Plugin Initialization — Performed once at plugin startup
2. Skins Reload — Performed when the user requests a skin reload

## Plugin Initialization

{% stepper %}
{% step %}

### Config Manager&#x20;

Performs initialization of the BepInEx config file.
{% endstep %}

{% step %}

### Mod Data Locations

Creates necessary folders for Skins to operate.
{% endstep %}

{% step %}

### Loads Gear Dump

Loads existing gear dump (used for editor), and prepares for further writes to the dump.
{% endstep %}

{% step %}

### Load Shader References

Loads references to shaders that we are aware of (for editor and caching).
{% endstep %}

{% step %}

### Write Internal Data

Writes internal data for editor use
{% endstep %}

{% step %}

### Skin Group Initialization

{% stepper %}
{% step %}

### Normalize Folders

Performs [folder name normalization](/skins/schema/skin-group.md#folder-normalization) unless disabled in config (default: not disabled).
{% endstep %}

{% step %}

### Move Per-Profile Skins to Global Skins Folder

Moves all per-profile Skin Group folders to the global skins folder if possible and enabled in config (default: enabled).
{% endstep %}

{% step %}

### Registers Dummy Vanilla Skins Group

Registers the virtual vanilla GTFO skins Skin Group.
{% endstep %}

{% step %}

### Load Global Skins

Loads all skins in the [global skins folder](/skins/schema/paths.md#data-folder).
{% endstep %}

{% step %}

### Load Per-Profile Skins

Loads all skins in the [per-profile skins folder](/skins/schema/paths.md#per-profile-skins-folder).
{% endstep %}
{% endstepper %}
{% endstep %}

{% step %}

### Register Types for IL2CPP

Register Mono types in il2cpp for Behaviours.
{% endstep %}

{% step %}

### Apply Harmony Patches

Apply necessary patches for material modification at runtime.
{% endstep %}

{% step %}

### Start Skin Process and Dev UI `OnAllManagersSetup`

Start processes to monitor keybinds and create dev UI elements once managers are setup.
{% endstep %}
{% endstepper %}

## Skins Reload

{% stepper %}
{% step %}

### Clear Skin Groups

Remove all skin group references.
{% endstep %}

{% step %}

### Unload Assets

Unload managed textures and texture macros.
{% endstep %}

{% step %}

### Re-Initialize

Performs [#skin-group-initialization](#skin-group-initialization "mention").
{% endstep %}

{% step %}

### Update All `ManagedMaterialTargets`

Update all Mesh Renders and Filters that are currently managed so that their texture references are updated.
{% endstep %}
{% endstepper %}
