Table of Contents

Class AssetBindingBuilder<TAsset>

Namespace
Plugins.Saneject.Runtime.Bindings.Asset
Assembly
Saneject.Runtime.dll

Fluent builder for configuring asset bindings in a Scope. Allows specifying how to locate UnityEngine.Object assets via direct instance, Resources, or AssetDatabase. Returned from BindAsset<TAsset>() or BindAssets<TAsset>().

public class AssetBindingBuilder<TAsset> where TAsset : Object

Type Parameters

TAsset
Inheritance
object
AssetBindingBuilder<TAsset>

Constructors

AssetBindingBuilder(AssetBinding)

Initializes a new instance of the AssetBindingBuilder<TAsset> class.

public AssetBindingBuilder(AssetBinding binding)

Parameters

binding AssetBinding

The Plugins.Saneject.Runtime.Bindings.Asset.AssetBinding to configure.

Methods

FromAssetLoad(string)

Locate the UnityEngine.Object asset at the specified path using UnityEditor.AssetDatabase.LoadAssetAtPath(string, System.Type).

public AssetFilterBuilder<TAsset> FromAssetLoad(string assetPath)

Parameters

assetPath string

The asset path.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

FromFolder(string)

Locate all UnityEngine.Objects of type TAsset in the specified folder using UnityEditor.AssetDatabase.FindAssets(string, string[]).

public AssetFilterBuilder<TAsset> FromFolder(string folderPath)

Parameters

folderPath string

The folder path.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

FromInstance(TAsset)

Bind to the specified UnityEngine.Object instance.

public AssetFilterBuilder<TAsset> FromInstance(TAsset instance)

Parameters

instance TAsset

The asset instance.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

FromMethod(Func<IEnumerable<TAsset>>)

Locate multiple UnityEngine.Objects using the provided method.

public AssetFilterBuilder<TAsset> FromMethod(Func<IEnumerable<TAsset>> method)

Parameters

method Func<IEnumerable<TAsset>>

The method to resolve the assets.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

FromMethod(Func<TAsset>)

Locate the UnityEngine.Object using the provided method.

public AssetFilterBuilder<TAsset> FromMethod(Func<TAsset> method)

Parameters

method Func<TAsset>

The method to resolve the asset.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

FromResources(string)

Locate the UnityEngine.Object in a UnityEngine.Resources folder at the specified path using UnityEngine.Resources.Load(string).

public AssetFilterBuilder<TAsset> FromResources(string path)

Parameters

path string

The resource path.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

FromResourcesAll(string)

Locate all UnityEngine.Objects in a UnityEngine.Resources folder at the specified path using UnityEngine.Resources.LoadAll(string, System.Type).

public AssetFilterBuilder<TAsset> FromResourcesAll(string path)

Parameters

path string

The resource path.

Returns

AssetFilterBuilder<TAsset>

A AssetFilterBuilder<TAsset> to further configure the binding.

ToID(params string[])

Qualifies this binding with an ID. Only injection targets annotated with InjectAttribute that specify the same ID will resolve using this binding.

public AssetBindingBuilder<TAsset> ToID(params string[] ids)

Parameters

ids string[]

The identifiers to match against injection targets.

Returns

AssetBindingBuilder<TAsset>

The builder instance for fluent chaining.

ToMember(params string[])

Qualifies this binding to apply only when the injection target member (field or property) has one of the specified names.

public AssetBindingBuilder<TAsset> ToMember(params string[] memberNames)

Parameters

memberNames string[]

The field or property names on the injection target that this binding should apply to.

Returns

AssetBindingBuilder<TAsset>

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. The injection target is the Plugins.Saneject.Runtime.Bindings.Component that owns the field or property marked with InjectAttribute.

public AssetBindingBuilder<TAsset> ToTarget(params Type[] targetTypes)

Parameters

targetTypes Type[]

One or more target System.Type objects to match against.

Returns

AssetBindingBuilder<TAsset>

The builder instance for fluent chaining.

ToTarget<TTarget>()

Qualifies this binding to apply only when the injection target is of the given type. The injection target is the Plugins.Saneject.Runtime.Bindings.Component that owns the field or property marked with InjectAttribute.

public AssetBindingBuilder<TAsset> ToTarget<TTarget>()

Returns

AssetBindingBuilder<TAsset>

The builder instance for fluent chaining.

Type Parameters

TTarget

The target type this binding applies to.