diff --git a/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs b/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs index 0b584c9b..6c09d33d 100644 --- a/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs +++ b/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs @@ -216,7 +216,7 @@ void InstallTo(IContainerBuilder builder) } extraInstaller?.Install(builder); - builder.RegisterInstance(this); + builder.RegisterInstance(this).AsSelf(); } LifetimeScope GetRuntimeParent() diff --git a/VContainer/Assets/VContainer/Tests/Unity/LifetimeScopeTest.cs b/VContainer/Assets/VContainer/Tests/Unity/LifetimeScopeTest.cs index fef84c6f..2a798104 100644 --- a/VContainer/Assets/VContainer/Tests/Unity/LifetimeScopeTest.cs +++ b/VContainer/Assets/VContainer/Tests/Unity/LifetimeScopeTest.cs @@ -6,6 +6,8 @@ namespace VContainer.Tests.Unity { + class SampleLifetimeScope : LifetimeScope {} + public class LifetimeScopeTest { [Test] @@ -33,7 +35,8 @@ public IEnumerator CreateChild() builder.RegisterEntryPoint(Lifetime.Scoped).AsSelf(); })) { - parentLifetimeScope = new GameObject("LifetimeScope").AddComponent(); + parentLifetimeScope = new GameObject("SampleLifetimeScope") + .AddComponent(); } yield return null;