TriLib
Search Results for

    Show / Hide Table of Contents

    Class AssetLoaderFilePicker

    Extends IOAssetLoader to handle model file or directory selection using a platform-specific file picker. Once a user selects one or more files/folders, TriLib's loading pipeline is triggered to import the models (including materials, textures, etc.).

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    IOAssetLoader
    AssetLoaderFilePicker
    Inherited Members
    IOAssetLoader.AutoDestroy
    IOAssetLoader.OnLoad
    IOAssetLoader.OnMaterialsLoad
    IOAssetLoader.OnProgress
    IOAssetLoader.OnError
    IOAssetLoader.OnBeginLoad
    IOAssetLoader.WrapperGameObject
    IOAssetLoader.AssetLoaderOptions
    IOAssetLoader.HaltTask
    IOAssetLoader.DestroyMe()
    IOAssetLoader.GetExtensions()
    IOAssetLoader.OnItemsWithStreamSelected(IList<ItemWithStream>)
    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 AssetLoaderFilePicker : IOAssetLoader

    Methods

    Create()

    Creates a new AssetLoaderFilePicker singleton instance attached to a UnityEngine.GameObject in the current scene. By default, AutoDestroy is enabled, causing the component to self-destruct once loading completes or fails.

    Declaration
    public static AssetLoaderFilePicker Create()
    Returns
    Type Description
    AssetLoaderFilePicker

    A reference to the newly instantiated AssetLoaderFilePicker.

    LoadModelFromDirectoryPickerAsync(string, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, Action<bool>, Action<IContextualizedError>, GameObject, AssetLoaderOptions, bool)

    Opens an OS-native folder selection dialog asynchronously, allowing the user to pick one or more directories containing model files. TriLib then scans and loads any recognized models in the background, invoking the provided callbacks for load completion, material loading, progress, or errors.

    Declaration
    public void LoadModelFromDirectoryPickerAsync(string title, Action<AssetLoaderContext> onLoad, Action<AssetLoaderContext> onMaterialsLoad, Action<AssetLoaderContext, float> onProgress, Action<bool> onBeginLoad, Action<IContextualizedError> onError, GameObject wrapperGameObject, AssetLoaderOptions assetLoaderOptions, bool haltTask = false)
    Parameters
    Type Name Description
    string title

    The title displayed in the folder dialog window.

    Action<AssetLoaderContext> onLoad

    A callback invoked on the main thread once each model is loaded (before its materials may be fully processed).

    Action<AssetLoaderContext> onMaterialsLoad

    A callback invoked on the main thread after each model’s materials (textures, shaders, etc.) are fully loaded.

    Action<AssetLoaderContext, float> onProgress

    A callback reporting the model loading progress (range 0–1).

    Action<bool> onBeginLoad

    A callback invoked when loading starts, with a bool indicating whether any valid directories or files were selected.

    Action<IContextualizedError> onError

    A callback invoked if an error occurs during directory selection or loading, supplying an IContextualizedError for logging or UI feedback.

    GameObject wrapperGameObject

    An optional parent UnityEngine.GameObject under which loaded models will be placed. If null, the models are created at the scene’s root.

    AssetLoaderOptions assetLoaderOptions

    A set of AssetLoaderOptions that control the import process. If null, TriLib’s default options are used.

    bool haltTask

    If true, TriLib queues but does not initiate loading tasks immediately, enabling manual scheduling or chaining of loads.

    Remarks

    Similar to LoadModelFromFilePickerAsync(string, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, Action<bool>, Action<IContextualizedError>, GameObject, AssetLoaderOptions, bool) but uses a folder selection UI and attempts to load any recognized 3D files found in the chosen directories.

    LoadModelFromFilePickerAsync(string, Action<AssetLoaderContext>, Action<AssetLoaderContext>, Action<AssetLoaderContext, float>, Action<bool>, Action<IContextualizedError>, GameObject, AssetLoaderOptions, bool)

    Opens an OS-native file selection dialog asynchronously, allowing the user to pick one or more model files. TriLib then loads the selected model(s) in the background, invoking the provided callbacks at each stage (e.g., initial load, material load, progress, error).

    Declaration
    public void LoadModelFromFilePickerAsync(string title, Action<AssetLoaderContext> onLoad, Action<AssetLoaderContext> onMaterialsLoad, Action<AssetLoaderContext, float> onProgress, Action<bool> onBeginLoad, Action<IContextualizedError> onError, GameObject wrapperGameObject, AssetLoaderOptions assetLoaderOptions, bool haltTask = false)
    Parameters
    Type Name Description
    string title

    The title displayed in the file dialog window.

    Action<AssetLoaderContext> onLoad

    A callback invoked on the main thread once the model is loaded (but possibly before all materials have been processed).

    Action<AssetLoaderContext> onMaterialsLoad

    A callback invoked on the main thread after the model’s materials (textures, shaders, etc.) are fully loaded.

    Action<AssetLoaderContext, float> onProgress

    A callback that receives updates on the model loading progress (0 to 1).

    Action<bool> onBeginLoad

    A callback invoked when the loading process begins, passing a bool indicating whether any valid files were selected.

    Action<IContextualizedError> onError

    A callback invoked if any error occurs during the file selection or loading process, providing an IContextualizedError for debugging or user messaging.

    GameObject wrapperGameObject

    An optional parent UnityEngine.GameObject under which the loaded model(s) will be placed. If null, the models are created at the root scene level.

    AssetLoaderOptions assetLoaderOptions

    A set of AssetLoaderOptions that govern loading behavior (e.g., whether to import lights, animations, colliders, etc.). If null, TriLib default options are used.

    bool haltTask

    If true, TriLib prepares but does not immediately start loading tasks, letting you schedule or chain them manually.

    Remarks

    This method calls OnItemsWithStreamSelected once the user finishes selecting files, which triggers the actual load process through TriLib’s pipeline.

    Extension Methods

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