> 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-attachment-system/modular-attachment-subsystem/lifecycle.md).

# Lifecycle

### `Initialize`

Called when the `UWorld` is created. Currently a no-op — the cache and registry are lazily populated as components register.

### `Deinitialize`

```
Deinitialize()
  ├─ Cancel all streaming handles in AssetCache
  ├─ Empty AssetCache
  ├─ Empty TagToComponents
  ├─ Empty PendingUnloadTimers
  └─ Super::Deinitialize()
```

## Internal Data Structures

### `AssetCache`

```cpp
TMap<FSoftObjectPath, FAttachmentCacheEntry> AssetCache;
```

Keyed by the definition's soft object path. Each entry holds the streaming handle, ref count, load state, and list of waiting components.

### `TagToComponents`

```cpp
TMap<FGameplayTag, TArray<TWeakObjectPtr<UModularAttachmentComponent>>> TagToComponents;
```

Maps gameplay tags to component lists. A single component can appear under multiple tags (its `ComponentTag` plus each applied fragment's `FragmentTag`). Stale weak pointers are cleaned lazily on `GetComponentsByTag`.

### `PendingUnloadTimers`

```cpp
TMap<FSoftObjectPath, FTimerHandle> PendingUnloadTimers;
```

Tracks deferred unload timer handles. When a cache entry reaches RefCount 0, a timer is set for the next tick. If the entry is re-requested before the timer fires, the unload is cancelled.
