Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfaces and FromComponentInNewPrefab #666

Open
ut2496 opened this issue Nov 28, 2019 · 0 comments
Open

Interfaces and FromComponentInNewPrefab #666

ut2496 opened this issue Nov 28, 2019 · 0 comments

Comments

@ut2496
Copy link

ut2496 commented Nov 28, 2019

I recently shifted from Zenject v5.4 to Zenject 6+.
I understand that using AsSingle across multiple statements is not suitable anymore, I have been able to adapt the changes in most cases barring the following with interfaces.

I used the following way to install certain bindings while using v5.4

Container.Bind<IFoo>().To<Foo>().FromComponentInNewPrefab(Prefab).AsSingle();
Container.Bind<IBar>().To<Bar>().FromComponentInNewPrefab(Prefab).AsSingle();

This used to only create a single instance of Prefab. But in Zenject 6+ it creates a duplicate Prefab too. Switching the latter to AsCached doesn't work either.

Since Interfaces are binding to different ResultType I cant do something like this either:
Container.Bind<typeof(IFoo), typeof(IBar)>().To<Z>().FromComponentInNewPrefab(Prefab).AsSingle();

Is this the intended behavior now ? If Yes, then Is there a way now to get the same behavior as present in v5.4 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant