Class BaseComponentBindingBuilder<TComponent>
Base class for component binding builders, providing fluent methods for locating components.
public abstract class BaseComponentBindingBuilder<TComponent> where TComponent : class
Type Parameters
TComponentThe type of the component being bound. Can also be an interface.
- Inheritance
-
objectBaseComponentBindingBuilder<TComponent>
- Derived
Constructors
BaseComponentBindingBuilder(ComponentBinding)
Initializes a new instance of the BaseComponentBindingBuilder<TComponent> class.
protected BaseComponentBindingBuilder(ComponentBinding binding)
Parameters
bindingComponentBindingThe Plugins.Saneject.Runtime.Bindings.Component.ComponentBinding to configure.
Methods
From(Transform)
Locate the UnityEngine.Component on the specified UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> From(Transform transform)
Parameters
transformTransformThe transform to search on.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromAncestors(bool)
Locate the component on any ancestor UnityEngine.Transform of the Scope. Searches recursively upwards in all parents, grandparents, etc. until it finds a match. Shorthand for FromScopeAncestors(bool).
public ComponentFilterBuilder<TComponent> FromAncestors(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the Scope's own transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromAncestorsOf(Transform, bool)
Locate the UnityEngine.Component on any ancestor UnityEngine.Transform of the specified UnityEngine.Transform. Searches recursively upwards in all parents, grandparents, etc. until it finds a match.
public ComponentFilterBuilder<TComponent> FromAncestorsOf(Transform target, bool includeSelf = false)
Parameters
targetTransformThe transform whose ancestors to search.
includeSelfboolWhether to include the target transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromAnywhere(FindObjectsInactive, FindObjectsSortMode)
Locate the UnityEngine.Component anywhere in the scene using UnityEngine.Object.FindObjectsByType(System.Type, UnityEngine.FindObjectsSortMode)
- or within an isolated prefab asset using UnityEngine.Component.GetComponentsInChildren(System.Type, bool) from the prefab root.
public ComponentFilterBuilder<TComponent> FromAnywhere(FindObjectsInactive findObjectsInactive = FindObjectsInactive.Include, FindObjectsSortMode sortMode = FindObjectsSortMode.None)
Parameters
findObjectsInactiveFindObjectsInactiveWhether to include inactive objects in the search.
sortModeFindObjectsSortModeThe sort mode for the results.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromChildWithIndex(int)
Locate the component on the Scope's direct child UnityEngine.Transform with index. Shorthand for FromScopeChildWithIndex(int).
public ComponentFilterBuilder<TComponent> FromChildWithIndex(int index)
Parameters
indexintThe child index.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromChildWithIndexOf(Transform, int)
Locate the UnityEngine.Component on the specified UnityEngine.Transform's direct child UnityEngine.Transform with index.
public ComponentFilterBuilder<TComponent> FromChildWithIndexOf(Transform transform, int index)
Parameters
transformTransformThe transform whose child to search on.
indexintThe child index.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromDescendants(bool)
Locate the component on any descendant UnityEngine.Transform of the Scope. Searches recursively downwards in all children, grandchildren, etc. until it finds a match. Shorthand for FromScopeDescendants(bool).
public ComponentFilterBuilder<TComponent> FromDescendants(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the Scope's own transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromDescendantsOf(Transform, bool)
Locate the UnityEngine.Component on any descendant UnityEngine.Transform of the specified UnityEngine.Transform. Searches recursively downwards in all children, grandchildren, etc. until it finds a match.
public ComponentFilterBuilder<TComponent> FromDescendantsOf(Transform transform, bool includeSelf = false)
Parameters
transformTransformThe transform whose descendants to search.
includeSelfboolWhether to include the target transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromFirstChild()
Locate the component on the Scope's first direct child UnityEngine.Transform. Shorthand for FromScopeFirstChild().
public ComponentFilterBuilder<TComponent> FromFirstChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromFirstChildOf(Transform)
Locate the UnityEngine.Component on the specified UnityEngine.Transform's first direct child UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromFirstChildOf(Transform transform)
Parameters
transformTransformThe transform whose first child to search on.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromInstance(TComponent)
Bind to the specified UnityEngine.Component instance.
public ComponentFilterBuilder<TComponent> FromInstance(TComponent instance)
Parameters
instanceTComponentThe component instance.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromLastChild()
Locate the component on the Scope's last direct child UnityEngine.Transform. Shorthand for FromScopeLastChild().
public ComponentFilterBuilder<TComponent> FromLastChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromLastChildOf(Transform)
Locate the UnityEngine.Component on the specified UnityEngine.Transform's last direct child UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromLastChildOf(Transform transform)
Parameters
transformTransformThe transform whose last child to search on.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromMethod(Func<IEnumerable<TComponent>>)
Locate multiple UnityEngine.Components using the provided method.
public ComponentFilterBuilder<TComponent> FromMethod(Func<IEnumerable<TComponent>> method)
Parameters
methodFunc<IEnumerable<TComponent>>The method to resolve the components.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromMethod(Func<TComponent>)
Locate the UnityEngine.Component using the provided method.
public ComponentFilterBuilder<TComponent> FromMethod(Func<TComponent> method)
Parameters
methodFunc<TComponent>The method to resolve the component.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromParent()
Locate the component on the Scope's direct UnityEngine.Transform.parent. Shorthand for FromScopeParent().
public ComponentFilterBuilder<TComponent> FromParent()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromParentOf(Transform)
Locate the UnityEngine.Component on the direct parent of the specified UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromParentOf(Transform transform)
Parameters
transformTransformThe transform whose parent to search on.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromRootChildWithIndex(int)
Locate the UnityEngine.Component on the Scope UnityEngine.Transform UnityEngine.Transform.root's direct child UnityEngine.Transform with index.
public ComponentFilterBuilder<TComponent> FromRootChildWithIndex(int index)
Parameters
indexintThe child index.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromRootDescendants(bool)
Locate the UnityEngine.Component on any descendant UnityEngine.Transform of the Scope UnityEngine.Transform UnityEngine.Transform.root. Searches recursively downwards in all children, grandchildren, etc. until it finds a match.
public ComponentFilterBuilder<TComponent> FromRootDescendants(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the root in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromRootFirstChild()
Locate the UnityEngine.Component on the Scope UnityEngine.Transform UnityEngine.Transform.root's first direct child UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromRootFirstChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromRootLastChild()
Locate the UnityEngine.Component on the Scope UnityEngine.Transform UnityEngine.Transform.root's last direct child UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromRootLastChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromRootSelf()
Locate the UnityEngine.Component on the Scope UnityEngine.Transform UnityEngine.Transform.root.
public ComponentFilterBuilder<TComponent> FromRootSelf()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeAncestors(bool)
Locate the UnityEngine.Component on any ancestor UnityEngine.Transform of the Scope. Searches recursively upwards in all parents, grandparents, etc. until it finds a match.
public ComponentFilterBuilder<TComponent> FromScopeAncestors(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the current transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeChildWithIndex(int)
Locate the UnityEngine.Component on the Scope's direct child UnityEngine.Transform with index.
public ComponentFilterBuilder<TComponent> FromScopeChildWithIndex(int index)
Parameters
indexintThe child index.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeDescendants(bool)
Locate the UnityEngine.Component on any descendant UnityEngine.Transform of the Scope. Searches recursively downwards in all children, grandchildren, etc. until it finds a match.
public ComponentFilterBuilder<TComponent> FromScopeDescendants(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the current transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeFirstChild()
Locate the UnityEngine.Component on the Scope's first direct child UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromScopeFirstChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeLastChild()
Locate the UnityEngine.Component on the Scope's last direct child UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromScopeLastChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeParent()
Locate the UnityEngine.Component on the Scope's direct UnityEngine.Transform.parent.
public ComponentFilterBuilder<TComponent> FromScopeParent()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeSelf()
Locate the UnityEngine.Component on the Scope's own UnityEngine.Transform.
public ComponentFilterBuilder<TComponent> FromScopeSelf()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromScopeSiblings()
Locate the UnityEngine.Component on any sibling UnityEngine.Transform of the Scope (other children of the same parent).
public ComponentFilterBuilder<TComponent> FromScopeSiblings()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromSelf()
Locate the component on the Scope's own UnityEngine.Transform. Shorthand for FromScopeSelf().
public ComponentFilterBuilder<TComponent> FromSelf()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromSiblings()
Locate the component on any sibling UnityEngine.Transform of the Scope (other children of the same parent). Shorthand for FromScopeSiblings().
public ComponentFilterBuilder<TComponent> FromSiblings()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromSiblingsOf(Transform)
Locate the UnityEngine.Component on any sibling UnityEngine.Transform of the specified UnityEngine.Transform (other children of the same parent).
public ComponentFilterBuilder<TComponent> FromSiblingsOf(Transform transform)
Parameters
transformTransformThe transform whose siblings to search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetAncestors(bool)
Locate the UnityEngine.Component on any ancestor UnityEngine.Transform of the injection target. Searches recursively upwards in all parents, grandparents, etc. until it finds a match. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetAncestors(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the target transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetChildWithIndex(int)
Locate the UnityEngine.Component on the injection target's direct child UnityEngine.Transform with index. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetChildWithIndex(int index)
Parameters
indexintThe child index.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetDescendants(bool)
Locate the UnityEngine.Component on any descendant UnityEngine.Transform of the injection target. Searches recursively downwards in all children, grandchildren, etc. until it finds a match. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetDescendants(bool includeSelf = false)
Parameters
includeSelfboolWhether to include the target transform in the search.
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetFirstChild()
Locate the UnityEngine.Component on the injection target's first direct child UnityEngine.Transform. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetFirstChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetLastChild()
Locate the UnityEngine.Component on the injection target's last direct child UnityEngine.Transform. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetLastChild()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetParent()
Locate the UnityEngine.Component on the injection target's direct UnityEngine.Transform.parent. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetParent()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetSelf()
Locate the UnityEngine.Component on the injection target's own UnityEngine.Transform. Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetSelf()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.
FromTargetSiblings()
Locate the UnityEngine.Component on any sibling UnityEngine.Transform of the injection target (other children of the same parent). Injection target is the UnityEngine.Component of a field/property marked with InjectAttribute.
public ComponentFilterBuilder<TComponent> FromTargetSiblings()
Returns
- ComponentFilterBuilder<TComponent>
A ComponentFilterBuilder<TComponent> to further configure the binding.