Replies: 2 comments 2 replies
-
|
So, I experimented a bit and it turns out that EntryPoints registered as Transient work as expected for several reasons:
So EntryPoint's are not suitable for dynamically created objects in the current form, if I understand correctly. Is this a bug? Now my question is this - How to separate the logic in the case above? Should I implement my own PlayerLoop? 😁 |
Beta Was this translation helpful? Give feedback.
-
|
Hi! I am also facing a similar issue, and I believe the core of this is trying to follow this recommended approach
I understand the idea behind this affirmation and agree with it. But when working in a real case it just gives more problems than it solves.
And the communication should be done in this way: Model -> Service <- View. So basically I was registering my Service as a Entry point and the View injected into it. This works perfectly for objects that are already on Scene. But when trying to follow this approach with dynamically created objects it fails to work. Since Service are the ones that receive the injected View, they need to have some mechanism to handle the View state:
Not sure what would be the best solution to this... I was thinking that maybe a MVVM approach would suit the case, but everything comes back to the same issue so I believe the solution would be more of an architectural design choice. Probably some kind of mechanism that once a View is created it bind it to a specific Service and into this service the necessary dependencies are resolved. But then, it also seems like this is the start to overengineering for small projects. To be honest right now I spend more time fighting with the architecture of the code that developing the game 🥲 Please let me know if you have some idea for this, I believe a unify architecture is possible but thinking alone is hard to find the best solution |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I started using VContainer in a new project (I was using Zenject before). I liked the idea, but during the implementation of the enemy factory a problem arose. I want to use the approach that is described in the documentation, i.e. separating logic from presentation and IoC. I am also guided by the rule:
I have such a class structure:
As a Passive View, I use a class like this:
Presenter (logic)
And other dependency
I tried to create a different Scope for each enemy - it works, and it's convenient, but it's not the best solution. The only solution I found is to manually resolve dependencies in the factory through the constructor, but in this case you can't get EntryPoint benefits because they can't be registered at runtime.
So, my question is - is it worth using EntryPoint's and basically sticking to this approach in this case? How to resolve such dependencies properly?
So far it seems to me that VContainer is suitable for relatively single dependencies, like InputService, UI, etc. And for factories, the usual MonoBeahaviour approach is supposed to be used.
Thank you all for the answers! I hope you will help me 🙌
P.S. I realize that I may be overengineering, but I'm still interested in figuring it out :)
Beta Was this translation helpful? Give feedback.
All reactions