diff --git a/README.md b/README.md index 649df88..24ee50e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Fast and easy to use dependency injection library for Unity game engine. - **Property** injection. - **Method** injection. - Injection lifetime. +- Local scope injection. ## Installation @@ -50,9 +51,7 @@ public class TestClass } ``` -2. Inject instances by invoking `Inject()` method. You can use generic version of `Inject<>()` method on `GameObject` where the generic type parameter will represent the type of `GameObject` component that needs to be injected. You can also specify the lifetime of the injection: -- `Lifetime.Game` (default) : the dependency will exist as long as the application is running. -- `Lifetime.Scene` : dependencies will be cleared every time the active scene changes. +2. Inject instances by invoking `Inject()` method. You can use generic version of `Inject<>()` method on `GameObject` where the generic type parameter will represent the type of `GameObject` component that needs to be injected. ```csharp using UniDI; ... @@ -69,11 +68,11 @@ gameObjectInstance1.GetComponent().Inject(); //good way GameObject component injecting var gameObjectInstance2 = Instantiate(_gameObjectPrefab); -gameObjectInstance2.Inject(Lifetime.Game); +gameObjectInstance2.Inject(); //best way GameObject component injecting InjectedComponent typedInstance = Instantiate(_typedPrefab); -typedInstance.Inject(Lifetime.Scene); +typedInstance.Inject(); ``` 3. Resolve dependencies of injection consumer classes by invoking `Resolve()` method. Or you can use `GameObject` extension method on prefab to one row instantiate and resolving dependencies (has 9 overloads like original Instantiate method). @@ -98,6 +97,50 @@ GameObject gameObjectInstance2 = _gameObjectPrefab.InstantiateResolve