Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
上一个问题:链接
在我的应用程序中,我有三层:
如何设置Game Object Context将Model layer包含所有Data layer依赖项和Presentation层将包含所有Model和Data layers依赖项?
Game Object Context
Model layer
Data layer
Presentation
Model
Data layers
有没有办法设置父组件Game Object Context?
您可以通过右键单击 Scene Hierarchy 并选择 来添加 GameObjectContext Zenject -> GameObjectContext。您可以为数据、模型和演示添加一个。然后,您只需按照您希望容器父级的方式设置转换父级。根据您的描述,我认为您可能想要这样:
Zenject -> GameObjectContext
然后,您可以通过将 MonoInstaller 附加到每个上下文来添加每个安装程序。如果您愿意,您也可以在 SceneContext 安装程序中使用 FromSubContainerResolve 动态执行所有这些操作。