English | Русский
Run your async startup steps in order, with progress.
A small initialization pipeline for Unity and pure C#. Implement IInitializableAsync on any service, hand the services to InitializeManager, and it runs every Initialize() in sequence — exposing a 0..1 progress value and an OnCompleted callback. The core has no DI dependency; a Zenject integration ships as a sample.
Details
- .unitypackage — Releases
- UPM —
Window → Package Manager→+→Add package from git URL:https://github.com/SST-Systems/Initialization.gitAppend#tagto pin a version. - Manual — clone or download, copy to
Assets/.
Unity 2021.3+
The core is dependency-free — no DI framework required.
IInitializableAsync — implement on any service that needs async setup at startup. Single method Task Initialize().
IInitializeManager — the pipeline entry point: Action OnCompleted, Task Execute(), float GetInitializeProgress().
InitializeManager — default implementation. Receives the services through its constructor (IEnumerable<IInitializableAsync>) and runs them in order.
// 1. Implement IInitializableAsync on the services that need async startup
public class SaveSystem : IInitializableAsync
{
public async Task Initialize() => await LoadFromDiskAsync();
}
// 2. Hand the services to the manager — no DI container required
var manager = new InitializeManager(new IInitializableAsync[]
{
new SaveSystem(),
new RemoteConfigService(),
});
// 3. Run the pipeline
manager.OnCompleted += () => Debug.Log("All systems initialized");
await manager.Execute();
// Poll progress, e.g. for a loading bar
float progress = manager.GetInitializeProgress(); // 0..1Using a DI container? Bind your services and the manager, and let the container fill the constructor — see the Zenject for Initialization sample.
Zenject for Initialization — an installer that binds your IInitializableAsync services and InitializeManager, so the manager receives them automatically through DI. Import via Window → Package Manager → select Initialization → Samples tab.
- Services run sequentially, in the order you hand them to the constructor.
GetInitializeProgress()returns1when the list is empty, otherwisecompleted / total.OnCompletedfires once, right after the last service finishes.- DI-agnostic: construct
InitializeManagermanually (as above) or through any container — nothing in the core references a DI framework.
Distributed under the MIT License. Free for personal and commercial use.
Author — Egor Shesterikov.
