Skip to content

Delt06/di-systems

Repository files navigation

DI Systems

Version License: MIT

An extension to DI Framework that allows defining a specific order of execution for gameplay systems.

Developed and tested with Unity 2020.3.16f1

Table of contents

Installation

Prerequisites

Option 1

Option 2

Add the following line to Packages/manifest.json:

"com.deltation.di-systems": "https://github.com/Delt06/di-systems.git?path=Packages/com.deltation.di-systems",

Usage

Create a system:

using DELTation.DIFramework.Systems;
using UnityEngine;

public class HelloWorldSystem : IInitSystem
{
    public void Init()
    {
        Debug.Log("Hello DI Systems!");
    }
}

Create a system runner:

using DELTation.DIFramework.Systems;

public class GameSystemsRunner : SystemsRunnerBase
{
    protected override void ConstructSystems()
    {
        Add<HelloWorldSystem>();
    }
}

Create/modify your custom dependency container:

using DELTation.DIFramework;
using DELTation.DIFramework.Containers;

public class DiCompositionRoot : DependencyContainerBase
{
    protected override void ComposeDependencies(ICanRegisterContainerBuilder builder)
    {
        builder.Register<GameSystemsRunner>();
    }
}

Do not forget to attach a ContainerLifecyle for your custom container:
Container Lifecycle

Run the game and check the console output:
Console Output

About

An extension to DI Framework that allows defining a specific order of execution for gameplay systems.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages