Zenject
Zenject copied to clipboard
OnInstantiate not called with FromSubContainerResolve
Describe the bug A clear and concise description of what the bug is. OnInstantiate callback is not called used with FromSubContainerResolve To Reproduce Steps to reproduce the behavior:
1- Create a Installer with this bind
public class Installer : MonoInstaller
{
public Bar barPrefab;
public override void InstallBindings()
{
Container
.Bind<IFoo>()
.To<Foo>()
.AsSingle()
.OnInstantiated<Foo>(FooCallback);
Container
.Bind<IBar>()
.FromSubContainerResolve()
.ByNewContextPrefab(barPrefab)
.AsSingle()
.OnInstantiated(BarCallback);
}
private void FooCallback(InjectContext arg1, Foo arg2)
{
Debug.Log("Foo"); // CALLED
}
private void BarCallback(InjectContext arg1, object arg2)
{
Debug.Log("Bar"); // Not CALLED
}
}
Expected behavior A clear and concise description of what you expected to happen. BarCallback should be called
Screenshots If applicable, add screenshots to help explain your problem.
Extenject and Unity info (please complete the following information):
- Zenject version: 9.2
- Unity version: 2019.4.18
- Project's scripting backend [e.g. Mono/IL2CPP]
Additional context Add any other context about the problem here.