Skip to content

Commit

Permalink
Merge pull request #86 from hadashiA/ku/fix-docs
Browse files Browse the repository at this point in the history
[website] Add screenshot etc
  • Loading branch information
hadashiA authored Jan 9, 2021
2 parents f0e59fa + 7e85a43 commit a65ae5d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions website/docs/registering/register-factory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,22 @@ class ClassA
}
```

In this case, container.Instantiate etc. are also useful.

```csharp
builder.RegisterFactory<CharacterType, CharacterActor>(container =>
{
return characterType =>
{
var characterPrefab = ...
return container.Instantiate(characterPrefab, parentTransform);
}
}, Lifetime.Scoped);
```

See [Use Container directory](../resolving/use-container-directory) more information.

:::note
`Func <>` factory is like a short hand.
In complex cases, consider defining and registering your own factory class。
:::
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions website/docs/resolving/auto-inject-gameobjects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ title: Auto inject GameObject in the scene
In VContainer, objects that are not explicitly registered will not be injected. Therefore, execute Register for the object you want to inject.

If you want to run **"Inject Only"** into MonoBehaviour, you can do so by inserting GameObject in the `autoInjectGameObject` field of LifetimeScope.

![](./assets/screenshot_auto_inject_gameobjects.png)
2 changes: 1 addition & 1 deletion website/docs/resolving/use-container-directory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ClassA
// Instantiate with Inject
container.Instantiate(prefab);
container.Instantiate(prefab, parent);
container.Instantiate(prefab, position, rotation parent);
container.Instantiate(prefab, position, rotation, parent);
}
}
```
Expand Down

1 comment on commit a65ae5d

@vercel
Copy link

@vercel vercel bot commented on a65ae5d Jan 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.