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 AddSingleton with 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
Screenshots
Additional context
unity 2023.2.15
tested in editor
Reflex installed as readme says
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 forAddSingleton(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) andMainMenuView
with contractIWindow
which injected through[Inject] private readonly IEnumerable<IWindow> _windows;
toUIService
instance.To Reproduce Steps to reproduce the behavior:
Scope
(scene one)[inject]
AddSingleton
with provided instance overloadExpected behavior Instance get dependencies through
[Inject]
no matter what method overload was chosen to install itScreenshots
Additional context unity 2023.2.15 tested in editor Reflex installed as readme says