Skip to content

How to disable force injection for type registered by RegisterComponentInHierarchy #704

@Hitomilras

Description

@Hitomilras

Imagine you have some entity in the game that must be injected into another entities. For example, ProjectileManager.

This ProjectileManager registered using different lifetime scopes using "builder.RegisterComponentInHierarchy();". Now each LifetimeScope that have this type registered try to inject it.

How to override this behavior? I understand why plain C# types are injected when they are registered (because they are resolved by creating new instance), but for MonoBehavior it's not always required and I need to find a way to disable auto injection of registered MonoBehavior, how can i do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions