DI Cheats
A cheat system for DI Framework.
Developed and tested with Unity 2020.3.16f1
Table of contents
Installation
Before proceeding, please make sure you have the following dependencies installed:
Option 1
- Open Package Manager through Window/Package Manager
- Click "+" and choose "Add package from git URL..."
- Insert the URL: https://github.com/Delt06/di-cheats.git?path=Packages/com.deltation.di-cheats
Option 2
Add the following line to Packages/manifest.json
:
"com.deltation.di-cheats": "https://github.com/Delt06/di-cheats.git?path=Packages/com.deltation.di-cheats",
Usage
- Create a cheat menu:
using DELTation.DIFramework.Cheats;
using UnityEngine;
public class GameCheatMenu : CheatMenuBase
{
protected override void Build()
{
CreateButton("Log", () => Debug.Log("Hello from cheats."));
}
}
- Create or modify existing dependency container:
using DELTation.DIFramework;
using DELTation.DIFramework.Cheats;
using DELTation.DIFramework.Containers;
public class CompositionRoot : DependencyContainerBase
{
protected override void ComposeDependencies(ICanRegisterContainerBuilder builder)
{
builder.RegisterCheatMenu<GameCheatMenu>();
}
}
- Ensure there is a
ContainerLifecycle
attached to your container. - Ensure there is an
EventSystem
in your scene. - Tap the right top corner of the screen to open cheats.
Optional
Define DI_CHEATS_FORCE_IN_RELEASE
if you want to have cheats in a release build.