For AI agents: the complete documentation index is available at /AchEngine/ja/llms.txt, the full documentation bundle is available at /AchEngine/ja/llms-full.txt, and this page is available as Markdown at /AchEngine/ja/usage/di/installer.md.

AchEngineInstaller

AchEngineInstaller は AchEngineScope のサービス登録を定義します。

public class GameInstaller : AchEngineInstaller
{
    public override void Install(IServiceBuilder builder)
    {
        builder
            .Register<IGameService, GameService>()
            .Register<IPlayerService, PlayerService>(ServiceLifetime.Transient)
            .RegisterInstance<GameConfig>(config);
    }
}

空の GameObject に AchEngineScope を追加し、Inspector の Installers 配列へ GameInstaller を登録します。

AchEngineScope
└── Installers
    └── GameInstaller

VContainer がある場合は [Inject]、どこからでも取得する場合は ServiceLocator.Resolve<T>() を使います。

[Inject] private IGameService _game;
var game = ServiceLocator.Resolve<IGameService>();

Scope は Awake でコンテナを構築し、OnDestroy で破棄します。グローバル用の永続 Scope と、シーン固有の additive Scope を分けてください。