Class ComponentBindingBuilder<TComponent>
Fluent builder for configuring component bindings within a Scope.
Allows specifying how to locate Plugins.Saneject.Runtime.Bindings.Component instances from the scene- or prefab hierarchy.
Supports locating from the scope, injection target, custom transforms, scene-wide queries, or explicit instances.
Returned from binding methods like BindComponent<TComponent>() or BindMultipleComponents<TComponent>().
public class ComponentBindingBuilder<TComponent> : BaseComponentBindingBuilder<TComponent> where TComponent : class
Type Parameters
TComponent
- Inheritance
-
objectBaseComponentBindingBuilder<TComponent>ComponentBindingBuilder<TComponent>
- Inherited Members
Constructors
ComponentBindingBuilder(ComponentBinding)
Initializes a new instance of the ComponentBindingBuilder<TComponent> class.
public ComponentBindingBuilder(ComponentBinding binding)
Parameters
bindingComponentBindingThe Plugins.Saneject.Runtime.Bindings.Component.ComponentBinding to configure.
Methods
FromRuntimeProxy()
Configures this binding to use a Plugins.Saneject.Runtime.Proxy.RuntimeProxy<TComponent> intermediary.
public RuntimeProxyBindingBuilder FromRuntimeProxy()
Returns
- RuntimeProxyBindingBuilder
A RuntimeProxyBindingBuilder to configure the runtime proxy resolution strategy.
Remarks
Runtime proxies act as serialized placeholder assets for interface references Unity cannot serialize directly across runtime boundaries. During injection, Saneject creates or reuses the required proxy asset. During scope startup, registered components swap that placeholder for the real instance. If you do not specify a resolve method after calling this, the default is Plugins.Saneject.Runtime.Proxy.RuntimeProxyResolveMethod.FromGlobalScope.
ToID(params string[])
Only injection sites annotated with InjectAttribute that specify the same ID will resolve using this binding.
public ComponentBindingBuilder<TComponent> ToID(params string[] ids)
Parameters
idsstring[]The identifiers to match against injection sites.
Returns
- ComponentBindingBuilder<TComponent>
The builder instance for fluent chaining.
ToMember(params string[])
Qualifies this binding to apply only when the injection target member (field, property, or method) has one of the specified names.
public ComponentBindingBuilder<TComponent> ToMember(params string[] memberNames)
Parameters
memberNamesstring[]The field, property, or method names on the injection target that this binding should apply to.
Returns
- ComponentBindingBuilder<TComponent>
The builder instance for fluent chaining.
ToTarget(params Type[])
Qualifies this binding to apply only when the injection target is one of the specified types or a derived type. The injection target is the object that owns the field, property or method marked with InjectAttribute.
public ComponentBindingBuilder<TComponent> ToTarget(params Type[] targetTypes)
Parameters
targetTypesType[]One or more target System.Type objects to match against.
Returns
- ComponentBindingBuilder<TComponent>
The builder instance for fluent chaining.
ToTarget<TTarget>()
Qualifies this binding to apply only when the injection target is of the given type or a derived type. The injection target is the object that owns the field, property or method marked with InjectAttribute.
public ComponentBindingBuilder<TComponent> ToTarget<TTarget>()
Returns
- ComponentBindingBuilder<TComponent>
The builder instance for fluent chaining.
Type Parameters
TTargetThe target type this binding applies to.