ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 363 forks source link

Injection into editor window with dynamicly created through factory #612

Open Derojo opened 5 years ago

Derojo commented 5 years ago

At the moment we are creating a IMachine class with all its dependencies via a factory by ByNewContextPrefabResource.

Now the thing is I want to inject the IMachine class into a editor window so I can monitor data. Now when I inject it into the editor window it obviously gives an error because the IMachine isn't created yet.

Some solutions I came up with are :

  1. Fire a signal to the editor window, but then isn't this overkill for just this case.
  2. Create a scriptable object that serves as a datacontainer to be injected into the editor window.

What do you think about this, is there a neat solution for this?

blai30 commented 4 years ago

I would like to do something like this as well. I have a regular C# class for inventory that I bind to the container when the game starts. I would like to be able to modify this inventory in a custom editor window. How can I inject this inventory into the editor window?