[VContainer] Add application lifetime scope and configure message pipe

This commit is contained in:
Nikita Dugin
2026-04-07 23:50:52 +03:00
parent 8b1a4a939a
commit e2425d6634
7 changed files with 124 additions and 0 deletions
@@ -0,0 +1,30 @@
using MessagePipe;
using VContainer;
using VContainer.Unity;
public sealed class ApplicationLifetimeScope : LifetimeScope
{
protected override void Configure(IContainerBuilder builder)
{
RegisterMessagePipe(builder);
}
private void RegisterMessagePipe(IContainerBuilder builder)
{
#if UNITY_EDITOR
// Enable stack trace capture for diagnostics
builder.RegisterMessagePipe(options =>
{
options.EnableCaptureStackTrace = true;
});
// Set the global MessagePipe provider
builder.RegisterBuildCallback(container =>
{
GlobalMessagePipe.SetProvider(container.AsServiceProvider());
});
#else
builder.RegisterMessagePipe();
#endif
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 49a3db5919224d6ea8b572dfdb137912
timeCreated: 1775594105