> For the complete documentation index, see [llms.txt](https://tariksavas.gitbook.io/tarject/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tariksavas.gitbook.io/tarject/docs/how-to-use/factory/separatedobjectfactory.md).

# SeparatedObjectFactory

* It is used to create objects that do not derive from MonoBehaviour. When inheriting this class, the objects and parameters to be created must be defined as types.

Sample uses:

```csharp
public class Installer : GameObjectInstaller
{
    public override void Install(DIContainer container)
    {
        container.BindFactory<FooItem.Factory>();
        container.BindFactory<FooItemWithoutParam.Factory>();
    }
}

public class SampleClass : MonoInjecter
{
    [Inject]
    private readonly FooItem.Factory _fooItemFactory;
    
    [Inject]
    private readonly FooItemWithoutParam.Factory _fooItemWithoutParamFactory;

    protected override void Awake()
    {
        base.Awake();

        FooItem fooItem = _fooItemFactory.Create(26);

        FooItemWithoutParam fooItemWithoutParam = _fooItemWithoutParamFactory.Create();
    }
}

public class FooItem : IFactorable<int>
{
    private readonly Foo _foo;

    public FooItem(Foo foo)
    {
        _foo = foo;
    }

    public void InitializeFactory(int variable)
    {
        Debug.Log($"{_foo.index}: int variable is: {variable}");
    }

    public class Factory : SeparatedObjectFactory<FooItem, int> { }
}

public class FooItemWithoutParam : IFactorable
{
    private readonly Foo _foo;

    public FooItemWithoutParam(Foo foo)
    {
        _foo = foo;
    }

    public class Factory : SeparatedObjectFactory<FooItemWithoutParam> { }
}
```
