when non-mono class installed through `AddSingleton(object, Type)` it doesn't get dependencies through `[Inject]`
Antoshidza opened this issue · 1 comments
Describe the bug
When I use AddSingleton with already created non-mono instance then this instance doesn't get any deps through [Inject] inside it. At the same time same code works for AddSingleton(typeof(InstanceClass), typeof(IContract)). To be clear - I install all deps inside same scope and same installer.
On attached screen you can see that there is UIService installed with 2 calls (which I believe how many times it was resolved) and MainMenuView with contract IWindow which injected through [Inject] private readonly IEnumerable<IWindow> _windows; to UIService instance.
To Reproduce
Steps to reproduce the behavior:
- Create simple project with Reflex installed
- Prepare simple configuration with use of one
Scope(scene one) - Create non-mono class to obtain some deps through
[inject] - Create class to be injected into previous one
- Install both at the same scope using
AddSingletonwith provided instance overload - You should get null for injected field
Expected behavior
Instance get dependencies through [Inject] no matter what method overload was chosen to install it
Additional context
unity 2023.2.15
tested in editor
Reflex installed as readme says
Resolved here
