docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ResourceReloader

    The resources that need to be reloaded in Editor can live in Runtime. The reload call should only be done in Editor context though but it could be called from runtime entities.

    Inheritance
    object
    ResourceReloader
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public static class ResourceReloader

    Methods

    EnsureResources<T, S>(bool, ref T, string, Func<S, bool>, S)

    Ensures that all resources in a container has been loaded

    Declaration
    public static void EnsureResources<T, S>(bool forceReload, ref T resources, string resourcePath, Func<S, bool> checker, S settings) where T : RenderPipelineResources where S : RenderPipelineGlobalSettings
    Parameters
    Type Name Description
    bool forceReload

    Set to true to force all resources to be reloaded even if they are loaded already

    T resources

    The resource container with the resulting loaded resources

    string resourcePath

    The asset path to load the resource container from

    Func<S, bool> checker

    Function to test if the resource container is present in a RenderPipelineGlobalSettings

    S settings

    RenderPipelineGlobalSettings to be passed to checker to test of the resource container is already loaded

    Type Parameters
    Name Description
    T
    S

    ReloadAllNullIn(object, string)

    Looks for resources in the given container object and reload the ones that are missing or broken.

    Declaration
    public static bool ReloadAllNullIn(object container, string basePath)
    Parameters
    Type Name Description
    object container

    The object containing reload-able resources

    string basePath

    The base path for the package

    Returns
    Type Description
    bool

    True if something have been reloaded.

    TryReloadAllNullIn(object, string)

    Looks for resources in the given container object and reload the ones that are missing or broken. This version will still return null value without throwing error if the issue is due to AssetDatabase being not ready. But in this case the assetDatabaseNotReady result will be true.

    Declaration
    public static (bool hasChange, bool assetDatabaseNotReady) TryReloadAllNullIn(object container, string basePath)
    Parameters
    Type Name Description
    object container

    The object containing reload-able resources

    string basePath

    The base path for the package

    Returns
    Type Description
    (bool hasChange, bool assetDatabaseNotReady)
    • 1 hasChange: True if something have been reloaded.
    • 2 assetDatabaseNotReady: True if the issue preventing loading is due to state of AssetDatabase
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)