Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JanikHelbig committed Oct 28, 2021
1 parent 8f1d587 commit c39e738
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ Use the `#*.*.*` postfix to use a specific release of the package, e.g. `https:/
`TinyContainer` instances are components which can be added to GameObjects and can be nested in the Unity hierarchy.
Use `TinyContainer.For(this)` in your MonoBehaviours to access the nearest `TinyContainer` upwards in the hierarchy.

There is a singleton-like instance called the `Root` which all requests will fall back to.
You can setup your `Root` manually by putting a GameObject with a `TinyContainer` and `TinyContainerRoot` component at the scene root. Otherwise it's created automatically when `TinyContainer.Root` is first accessed.
There is a singleton-like instance called the `Global` which all requests will fall back to.
You can setup your `Global` manually by putting a GameObject with a `TinyContainer` and `TinyContainerGlobal` component at the scene root. Otherwise it's created automatically when `TinyContainer.Global` is first accessed.

Additionally you can create a `TinyContainer` which belongs to a specific scene. If you add a `TinyContainerScene` component to a container, your MonoBehaviours can access it by using `TinyContainer.ForSceneOf(this)`, provided they belong to the same scene. When trying to find the closest container or trying to resolve a type, the request will try to locate a scene container before falling back to the Root.
Additionally you can create a `TinyContainer` which belongs to a specific scene. If you add a `TinyContainerScene` component to a container, your MonoBehaviours can access it by using `TinyContainer.ForSceneOf(this)`, provided they belong to the same scene. When trying to find the closest container or trying to resolve a type, the request will try to locate a scene container before falling back to Global.

### Registering Instances
You have two options when registering your types with a container.
```cs
private void Awake()
{
TinyContainer.Root
TinyContainer.Global
// Register a instance directly.
.Register<ILocalizer>(new MockLocalizer())
// Register a factory method which will be executed
Expand Down

0 comments on commit c39e738

Please sign in to comment.