-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
I find the current “Greeter” example a bit unintuitive for users who are new to the dependency injection pattern. While it’s great for people already familiar with DI, it doesn’t provide much guidance for Unity developers who are used to MonoBehaviour singletons and want to learn how to migrate their code to Reflex.
It would be really helpful to include an additional example or section in the README that:
- Starts with a typical Unity singleton (e.g.
GameManager.Instancepattern). - Then demonstrates how to convert it to Reflex DI, step by step.
🧩 Example Idea
For instance, start with:
public class GameManager : MonoBehaviour
{
public static GameManager Instance;
void Awake() => Instance = this;
public void StartGame() => Debug.Log("Game Started");
}Then show how to rewrite it using Reflex:
public class GameManager
{
public void StartGame() => Debug.Log("Game Started");
}
public class GameInstaller : MonoBehaviour, IInstaller
{
public void InstallBindings(ContainerBuilder builder)
{
builder.AddSingleton<GameManager>();
}
}And how to inject it:
public class GameStarter : MonoBehaviour
{
[Inject] private GameManager _gameManager;
void Start() => _gameManager.StartGame();
}This kind of example would make it much easier for newcomers to understand how Reflex replaces common Unity patterns and what the benefits are.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels