VContainer icon indicating copy to clipboard operation
VContainer copied to clipboard

Which should take precedence, EnqueueParent or Component's Parent?

Open adarapata opened this issue 3 years ago • 1 comments

using (LifetimeScope.EnqueueParent(parentLifeTimeScope))
{
    // instantiate LifeTimeScope instance
}

If Parent is set on the Prefab side, using LifetimeScope.EnqueueParent will not overwrite it, and the original Parent will remain set.

The parentReference is returned before the overrideParent as the priority of the Parent returned by GetRuntimeParent(). https://github.com/hadashiA/VContainer/blob/master/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs#L270-L288

I thought this was counter-intuitive as EnqueueParent behavior, but is it as expected?

adarapata avatar Sep 08 '22 09:09 adarapata

@adarapata Hi,

It seems you have a point. In the past, EnqueueParent's priority is high.

The problem was reported in #245. When there are multiple LifetimeScope parent-child relationships in the same scene, high-priority-EnqueueParent breaks them.

We should find a way to solve both of these problems.

hadashiA avatar Sep 19 '22 04:09 hadashiA