Replies: 1 comment 6 replies
-
In my opinion, you should not directly Inject an object like "Player". I prefer the DDD style, i.e.,
This is a general statement. Not sure if it will fit your case perfectly. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My game has support for local multiplayer. Each player is assigned their own
IInputService
whose implementation reads input from their assigned controller.However, things get more complicated in my test suite. Among other things, my tests include:
These resources are not transient because they're loaded as assets, or they contain state that needs to be known by multiple dependency recipients.
If they were transient, I could inject a factory function. However, that's not the case.
Also, these dependencies are generally disposable; they're assets that I loaded from Addressables that need to be cleaned up when the test ends. I've wrapped them in objects that implement
IDisposable
, but I still have to guarantee that they're disposed of.What would you suggest?
Beta Was this translation helpful? Give feedback.
All reactions