Mathijs-Bakker / Extenject

Dependency Injection Framework for Unity Game Engine
MIT License
531 stars 97 forks source link

Passing dynamic data + prefab through method Create (Factory) while that prefab has GameObjectContext #72

Open lucid-dreamm opened 1 year ago

lucid-dreamm commented 1 year ago

Hey, I would like to be able to pass dynamic data + prefab through method Create (Factory) while that prefab has GameObjectContext (Installer). In this situation, it seems zenject cannot inject dynamic data and it fails while without GameObjectContext, it works.

_factory.Create(prefab,data)

In scene context

  Container.BindFactory<Object, SpawnModuleData, ModuleFacade, ModuleFacade.Factory>()
                .FromFactory<PrefabFactory<SpawnModuleData, ModuleFacade>>();
ghpxi commented 1 year ago

Faced the same problem, after hours of trying to solve it I found worked solution. https://gitter.im/Extenject/community?at=5e35648e3aca1e4c5f5980e5 Would like to see any comments regarding this solution and maybe better approach for dealing with this case