C#C
C#3y ago
Theos

❔ Unity Zenject qustion

Hey, I have a question about Zenject.

So I have a class

public class Test
{
  public Something _Smth;
  public Foo _Foo;
  private int Id;

  public Test(Somethnig smth, Foo foo)
  {
    _Smth = smth;
    _Foo = foo;
  }
}


and I install it like this
 Container.RegisterNewInstance<Foo>();
 Container.RegisterNewInstance<Something>();


then I have a list List<Test> Tests

What I want to do is somehow make a for-loop that will create and add Test to Tests list. I want to make sure that _Smth and _Foo are installed using Zenject and I want to pass Id when I create this object. From my understanding of zenject if i do var test = new Test() it wont work cuz Something and Foo wont be installed right?
Was this page helpful?