Dignus.Unity 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dignus.Unity --version 1.1.3
                    
NuGet\Install-Package Dignus.Unity -Version 1.1.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dignus.Unity" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dignus.Unity" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Dignus.Unity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dignus.Unity --version 1.1.3
                    
#r "nuget: Dignus.Unity, 1.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Dignus.Unity@1.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dignus.Unity&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=Dignus.Unity&version=1.1.3
                    
Install as a Cake Tool

Dignus.Unity

Lightweight Unity integration for the Dignus framework. It provides dependency injection helpers, scene lifecycle coordination, coroutine scheduling, resource caching, object pooling, and bindable properties.

Requirements

  • Unity 2022.3 or later
  • A project that can load assets from Unity Resources folders

Installation

NuGet

Package page: Dignus.Unity on NuGet.org

dotnet add package Dignus.Unity --version 1.1.3

Or use PackageReference:

<PackageReference Include="Dignus.Unity" Version="1.1.3" />

NuGet resolves the Dignus dependency automatically.

Unity Package Manager

Add the Git dependency to Packages/manifest.json:

{
  "dependencies": {
    "com.dignus.unity": "https://github.com/EomTaeWook/Dignus.Unity.git?path=/publish/upm/com.dignus.unity#v1.1.3"
  }
}

The path query parameter must appear before the revision fragment. The Git package already contains its compatible Dignus.dll; do not add another copy of that assembly to the Unity project.

The published package contains:

publish/upm/com.dignus.unity/
  package.json                 package.json.meta
  README.md                    README.md.meta
  LICENSE                      LICENSE.meta
  Icon.jpg                     Icon.jpg.meta
  Runtime/                     Runtime.meta
    Dignus.Unity.dll           Dignus.Unity.dll.meta
    Dignus.dll                 Dignus.dll.meta

Runtime flow

  1. Register application dependencies and build the service container once.
  2. Load scenes through DignusUnitySceneManager.
  3. SceneBase.Awake() resolves and binds the scene controller.
  4. OnAwakeScene() initializes scene-specific state and UI.
  5. Manager-controlled scene transitions invoke OnDestroyScene() for cleanup.

OnDestroyScene() is a Dignus.Unity lifecycle method. Unity does not invoke it automatically when a GameObject is destroyed or when a scene is unloaded through UnityEngine.SceneManagement.SceneManager directly.

Dependency injection

Mark services and controllers with [Injectable], then register the application assembly once during startup:

using Dignus.DependencyInjection.Attributes;
using Dignus.Unity;
using Dignus.Unity.DependencyInjection;
using Dignus.Unity.Framework;

[Injectable(LifeScope.Singleton)]
public sealed class LobbySceneController : SceneControllerBase<LobbyScene>
{
    private readonly GameClientService _gameClientService;

    public LobbySceneController(GameClientService gameClientService)
    {
        _gameClientService = gameClientService;
    }

    public override void Dispose()
    {
    }
}

public sealed class ApplicationManager : SingletonMonoBehaviour<ApplicationManager>
{
    private bool _initialized;

    public void Initialize()
    {
        if (_initialized)
        {
            return;
        }

        var container = DignusUnityServiceContainer.RegisterDependencies(GetType().Assembly);
        container.Build();
        _initialized = true;
    }
}

Resolve services only after Build() has completed:

var controller = DignusUnityServiceContainer.GetService<LobbySceneController>();

If an injectable type has multiple public constructors, annotate the constructor to use with [InjectConstructor].

Scene architecture

SceneBase<TController> resolves the controller before calling OnAwakeScene() and binds the scene automatically:

using Dignus.Unity.Framework;

public sealed class LobbyScene : SceneBase<LobbySceneController>
{
    protected override void OnAwakeScene()
    {
        SceneController.Initialize();
    }

    public override void OnDestroyScene()
    {
        SceneController.Dispose();
    }
}

Runtime constructor arguments

Unity components assigned to the inherited InjectedComponents array are matched to controller constructor parameters before the container is used as a fallback:

public sealed class LobbySceneController : SceneControllerBase<LobbyScene>
{
    private readonly LobbyUI _lobbyUI;

    public LobbySceneController(LobbyUI lobbyUI, GameClientService gameClientService)
    {
        _lobbyUI = lobbyUI;
    }

    public override void Dispose()
    {
    }
}

In the Unity Inspector, add the scene's LobbyUI component to LobbyScene.InjectedComponents. Do not assign InjectedComponents inside OnAwakeScene()—controller resolution has already happened by then.

Bindable properties

using Dignus.Unity.Binding;

public sealed class LobbySceneModel : ISceneModel
{
    public BindableProperty<int> Gold { get; } = new BindableProperty<int>(0);
}

Subscribe and unsubscribe with the Unity component lifecycle:

private void OnEnable()
{
    _model.Gold.ValueChanged += OnGoldChanged;
    OnGoldChanged(_model.Gold.Value);
}

private void OnDisable()
{
    _model.Gold.ValueChanged -= OnGoldChanged;
}

Assigning an equal value does not raise ValueChanged. Call NotifyChanged() when the contained object changed internally without replacing the value.

Managers

Coroutine manager

DignusUnityCoroutineManager.Start(MyCoroutine());
DignusUnityCoroutineManager.Start(0.5f, MyCoroutine(), OnCompleted);

The scheduler advances from FixedUpdate() using Time.fixedDeltaTime. It therefore follows the physics update cadence and pauses when scaled fixed-time updates stop, including the usual Time.timeScale = 0 case.

Object pool

The extension methods handle parenting, activation, and deactivation:

using Dignus.Unity.Extensions;

var bullet = this.InstantiateWithPool(bulletPrefab);
bullet.Recycle();

Only objects obtained from DignusUnityObjectPool can be recycled into it. Returning an unrelated object throws InvalidOperationException.

The lower-level Pop() and Push() methods are also available, but callers are responsible for setting the parent and active state when using them directly.

Resource manager

Use [PrefabPath] to derive a Resources path from a component or asset type:

using Dignus.Unity.Attributes;
using UnityEngine;

[PrefabPath("Prefabs/UI")]
public sealed class LobbyUI : MonoBehaviour
{
}

var prefab = DignusUnityResourceManager.Instance.LoadAsset<LobbyUI>();

An explicit path is also supported:

var atlas = DignusUnityResourceManager.Instance.LoadAsset<SpriteAtlas>(
    "SpriteAtlases/Common");

Loaded assets are cached by resource path until UnloadAsset() is called.

Scene manager

var sceneManager = DignusUnitySceneManager.Instance;

sceneManager.LoadScene(SceneType.LobbyScene, scene =>
{
    // The loaded scene has completed Awake processing here.
});

sceneManager.LoadAdditiveScene(SceneType.HUD);
sceneManager.UnloadAdditiveScene(SceneType.HUD);

Load events are available for start, progress, and completion. Until an active load-state guard is added to the manager, submit the next load request only after the previous completion callback or completion event. Additive unload has no completion callback.

Each managed scene should contain one authoritative SceneBase. If several instances register during the same load, the last registered instance becomes the callback value.

Known lifecycle boundaries

  • Use the Dignus.Unity scene manager when OnDestroyScene() cleanup is required.
  • Configure InjectedComponents before SceneBase.Awake() runs.
  • Avoid issuing overlapping scene load requests.
  • Unsubscribe bindable-property and manager events when their owner is disabled or disposed.
  • Objects returned to the pool must originate from that pool.

License

Dignus.Unity is released under the MIT License. See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net48 is compatible.  net481 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

  • .NETFramework 4.8.1

  • .NETStandard 2.1

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.6 109 10/21/2026
1.1.5 105 10/19/2026
1.1.4 100 10/15/2026
1.1.3 116 9/14/2026
1.1.2 128 9/3/2026
1.1.1 113 9/3/2026
1.1.0 147 8/3/2026
1.0.16 144 6/24/2026
1.0.15 150 6/12/2026
1.0.14 143 5/8/2026
1.0.13 128 4/25/2026
1.0.12 133 4/5/2026
1.0.11 140 2/21/2026
1.0.10 151 1/31/2026
1.0.9 145 1/26/2026
1.0.8 463 12/11/2025
1.0.7 206 11/23/2025
1.0.6 271 11/22/2025
1.0.5 206 11/2/2025
1.0.4 228 10/31/2025
Loading failed