When I write the following code
public class AutoParentScope : LifetimeScope
{
public LifetimeScope parentScope;
protected override LifetimeScope FindParent()
{
var parentObj = transform.parent.gameObject;
if (parentScope == null)
{
return parentObj.GetComponentInParent<LifetimeScope>();
}
else
{
return parentScope;
}
}
}
Then I get the error message
System.NullReferenceException: Object reference not set to an instance of an object
at VContainer.Unity.LifetimeScope.Build () [0x0006e] in ./Library/PackageCache/jp.hadashikick.vcontainer@0cb993cc4615/Runtime/Unity/LifetimeScope.cs:199
at VContainer.Unity.LifetimeScope.Awake () [0x0004f] in ./Library/PackageCache/jp.hadashikick.vcontainer@0cb993cc4615/Runtime/Unity/LifetimeScope.cs:145
It seem likes the parent's container is not builded. Then it uses parent container
// ReSharper disable once PossibleNullReferenceException
Parent.Container.CreateScope(builder =>
{
builder.RegisterBuildCallback(SetContainer);
builder.ApplicationOrigin = this;
builder.Diagnostics = VContainerSettings.DiagnosticsEnabled ? DiagnositcsContext.GetCollector(scopeName) : null;
InstallTo(builder);
});
I just want to drag one scope in inspector and make it as child. Is it not allowed ?
Version 1.17.0
When I write the following code
Then I get the error message
System.NullReferenceException: Object reference not set to an instance of an object
at VContainer.Unity.LifetimeScope.Build () [0x0006e] in ./Library/PackageCache/jp.hadashikick.vcontainer@0cb993cc4615/Runtime/Unity/LifetimeScope.cs:199
at VContainer.Unity.LifetimeScope.Awake () [0x0004f] in ./Library/PackageCache/jp.hadashikick.vcontainer@0cb993cc4615/Runtime/Unity/LifetimeScope.cs:145
It seem likes the parent's container is not builded. Then it uses parent container
I just want to drag one scope in inspector and make it as child. Is it not allowed ?
Version 1.17.0