ObjectInstaller

Installers that we do not want to be present in the scene and that we call from another GameObjectInstaller must be derived from this class. The relevant installer is created by calling the CreateAndInstall method from GameObjectInstaller. The relevant container is also sent as a parameter.

Sample uses:

public class AppInstaller : GameObjectInstaller
{
    public override void Install(DIContainer container)
    {
        FooInstaller.CreateAndInstall(container);
    }
}

public class FooInstaller : ObjectInstaller<FooInstaller>
{
    public override void Install(DIContainer container)
    {
        container.Bind<Foo>().WithId("foo1");
        container.Bind<FooController>();
    }
}
public class AppInstaller : GameObjectInstaller
{
    public override void Install(DIContainer container)
    {
        ObjectInstaller.CreateAndInstall<FooInstaller>(container);
    }
}

public class FooInstaller : ObjectInstaller
{
    public override void Install(DIContainer container)
    {
        container.Bind<Foo>().WithId("foo1");
        container.Bind<FooController>();
    }
}

Last updated