TriLib
Search Results for

    Show / Hide Table of Contents

    Class AssetDownloaderBehaviour

    Provides coroutines for asynchronously downloading model data from a remote source, then passing that data to TriLib’s AssetLoader or AssetLoaderZip for actual model loading. This component is spawned at runtime by LoadModelFromUri(UnityWebRequest, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, Action<IContextualizedError>, GameObject, AssetLoaderOptions, object, string, bool?, bool) and automatically destroyed once the download and loading processes finish.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    AssetDownloaderBehaviour
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: TriLibCore
    Assembly: Assembly-CSharp.dll
    Syntax
    public class AssetDownloaderBehaviour : MonoBehaviour

    Methods

    DownloadAsset(UnityWebRequest, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, GameObject, Action<IContextualizedError>, AssetLoaderOptions, object, string, bool?)

    Downloads the model data via the given unityWebRequest, then hands off the data to the appropriate loading method (LoadModelFromStream(Stream, string, string, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, Action<IContextualizedError>, GameObject, AssetLoaderOptions, object, bool, Action<AssetLoaderContext>, bool) or LoadModelFromZipStream(Stream, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, Action<IContextualizedError>, GameObject, AssetLoaderOptions, object, string, bool, string, Action<AssetLoaderContext>)) based on file extension or content type. Once completed, this UnityEngine.GameObject is destroyed.

    Declaration
    public IEnumerator DownloadAsset(UnityWebRequest unityWebRequest, Action<AssetLoaderContext> onLoad, Action<AssetLoaderContext> onMaterialsLoad, Action<AssetLoaderContext, float> onProgress, GameObject wrapperGameObject, Action<IContextualizedError> onError, AssetLoaderOptions assetLoaderOptions, object customContextData, string fileExtension, bool? isZipFile = null)
    Parameters
    Type Name Description
    UnityWebRequest unityWebRequest

    The UnityEngine.Networking.UnityWebRequest object prepared for downloading the model data.

    Action<AssetLoaderContext> onLoad

    A callback invoked on the main thread once the core model data has been processed (but before materials are fully loaded).

    Action<AssetLoaderContext> onMaterialsLoad

    A callback invoked on the main thread once the model’s materials (textures, shaders, etc.) have finished loading.

    Action<AssetLoaderContext, float> onProgress

    A callback invoked throughout the download and loading process, indicating progress with a float in the range [0, 1].

    GameObject wrapperGameObject

    An optional parent UnityEngine.GameObject under which the loaded model's UnityEngine.GameObject is placed. Can be null for a root-level object.

    Action<IContextualizedError> onError

    A callback invoked if any error occurs during download or loading. Called on the main thread.

    AssetLoaderOptions assetLoaderOptions

    The AssetLoaderOptions controlling how the model is loaded (e.g., materials, textures, animations).

    object customContextData

    Optional custom data that can be stored in the AssetLoaderContext for reference in the loading pipeline.

    string fileExtension

    The file extension for the model (e.g., ".fbx"), if known. If the file is recognized as a .zip, this may be used for the internal file within the archive.

    bool? isZipFile

    A boolean (or null) indicating whether the file is a .zip archive. If null, the method infers this based on the Content-Type header or fileExtension.

    Returns
    Type Description
    IEnumerator

    An IEnumerator that can be yielded in a Unity coroutine, controlling the download process. Once the download completes and loading is triggered, this object destroys itself via Object.Destroy.

    Extension Methods

    IObjectExtensions.TryToDispose<T>(object)
    In this article
    Back to top Generated by DocFX