gustavopsantos/Reflex

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:

  1. Create simple project with Reflex installed
  2. Prepare simple configuration with use of one Scope (scene one)
  3. Create non-mono class to obtain some deps through [inject]
  4. Create class to be injected into previous one
  5. Install both at the same scope using AddSingleton with provided instance overload
  6. You should get null for injected field

Expected behavior
Instance get dependencies through [Inject] no matter what method overload was chosen to install it

Screenshots
image

Additional context
unity 2023.2.15
tested in editor
Reflex installed as readme says

Resolved here