Conversation
|
Would it be possible to merge this PR? Anything we can do to make it happen? Thanks 🙏 |
|
I am reluctant to merge this. As I am not convinced it solves the problem. The GOC is a sub container of the Scene Context. When you change this behavior you just make it unpredictable for the users. There must be another way to solve the issue. Eg.
|
|
Actually it does not affect only legacy projects (however mostly), but also cases where complex scene management is an overkill compared to having some persistent context. Actually what we would like to see here is something between ProjectContext and SceneContext. Make use of GameObjectContext is quite interesting as there are no new concepts here: contracts are already known, it's just allowing contracts from SceneContext to GameObjectContext. Could you elaborate a bit more on "you just make it unpredictable for the users."? My understanding of this PR is: Another approach I can think of is to make use of SubContainers, however currently (if I understand it correctly) it might be tricky to dynamically remove and add bindings at runtime. |
Motivation
In bigger projects it may be convenient to use
GameObjectContextas a parent forSceneContext.Consider case where you have some non-standard context that is recreated every time player switches accounts / characters. The best approach would be to use scene contexts and their contracts functionality. However in some legacy projects it can be pretty hard and time consuming to achieve this (e.g. because of the usage of
LoadSceneMode.Single). Switching toLoadSceneMode.Additivemay expose many issues connected with scene unloading order.Pull request checklist
Please check if your PR fulfills the following requirements:
Pull request type
Please check the type of change your PR introduces:
Issue Number
Issue Number: N/A
Create or search an issue here: Extenject/Issues
What is the current behavior?
What is the new behavior?
GameObjectContexthas additional field namedContractNameswhich is used within the initialisation ofSceneContext.SceneContextcannot find the parentSceneContextfor givenParentContractName, it searches for matchingGameObjectContext.Does this introduce a breaking change?
Other information
GameObjectAsParentContracttest added to the Integration Tests section.On which Unity version has this been tested?
Scripting backend: