[VContainer] Add application lifetime scope and configure message pipe
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user