Search Results for

    Show / Hide Table of Contents

    Class Content

    Loads and manages assets.

    Inheritance
    Content
    Assembly: FlaxEngine.dll
    File: Engine/Content/Content.h
    Syntax
    public class Content

    Fields

    AssetDisposing

    Occurs when asset is being disposed and will be unloaded (by force). All references to it should be released.

    Declaration
    public static Delegate<Asset* > AssetDisposing
    Field Value
    Delegate<Asset >

    AssetReloading

    Occurs when asset is being reloaded and will be unloaded (by force) to be loaded again (e.g. after reimport). Always called from the main thread.

    Declaration
    public static Delegate<Asset* > AssetReloading
    Field Value
    Delegate<Asset >

    AssetsUnloadInterval

    The time after asset with no references will be unloaded.

    Declaration
    public static TimeSpan AssetsUnloadInterval
    Field Value
    TimeSpan

    AssetsUpdateInterval

    The time between content pool updates.

    Declaration
    public static TimeSpan AssetsUpdateInterval
    Field Value
    TimeSpan

    Methods

    CloneAssetFile(const StringView& dstPath, const StringView& srcPath, const Guid& dstId)

    Clones the asset file.

    Declaration
    public static bool CloneAssetFile(const StringView& dstPath, const StringView& srcPath, const Guid& dstId)
    Parameters
    StringView dstPath

    The destination path.

    StringView srcPath

    The source path.

    Guid dstId

    The destination id.

    Returns
    bool

    True if failed, otherwise false.

    CreateTemporaryAssetPath()

    Generates temporary asset path.

    Declaration
    public static String CreateTemporaryAssetPath()
    Returns
    String

    Asset path for a temporary usage.

    CreateVirtualAsset()

    Creates temporary and virtual asset of the given type.

    Declaration
    public static T* CreateVirtualAsset()
    Returns
    T

    Created asset or null if failed.

    Type Parameters
    typename T

    CreateVirtualAsset(const MClass* type)

    Creates temporary and virtual asset of the given type.

    Declaration
    public static Asset* CreateVirtualAsset(const MClass* type)
    Parameters
    MClass type

    The asset type klass.

    Returns
    Asset

    Created asset or null if failed.

    CreateVirtualAsset(const ScriptingTypeHandle& type)

    Creates temporary and virtual asset of the given type.

    Declaration
    public static Asset* CreateVirtualAsset(const ScriptingTypeHandle& type)
    Parameters
    ScriptingTypeHandle type

    The asset type.

    Returns
    Asset

    Created asset or null if failed.

    DeleteAsset(Asset* asset)

    Deletes the specified asset.

    Declaration
    public static void DeleteAsset(Asset* asset)
    Parameters
    Asset asset

    The asset.

    DeleteAsset(const StringView& path)

    Deletes the asset at the specified path.

    Declaration
    public static void DeleteAsset(const StringView& path)
    Parameters
    StringView path

    The asset path.

    FastTmpAssetClone(const StringView& path, String& resultPath)

    Performs the fast temporary asset clone to the temporary folder.

    Declaration
    public static bool FastTmpAssetClone(const StringView& path, String& resultPath)
    Parameters
    StringView path

    The source path.

    String resultPath

    The result path.

    Returns
    bool

    True if failed, otherwise false.

    GetAllAssets()

    Finds all the asset IDs. Uses asset registry.

    Declaration
    public static Array<Guid, HeapAllocation> GetAllAssets()
    Returns
    Array<Guid, HeapAllocation>

    The list of all asset IDs.

    GetAllAssetsByType(const MClass* type)

    Finds all the asset IDs by type (exact type, without inheritance checks). Uses asset registry.

    Declaration
    public static Array<Guid, HeapAllocation> GetAllAssetsByType(const MClass* type)
    Parameters
    MClass type

    The asset type.

    Returns
    Array<Guid, HeapAllocation>

    The list of asset IDs that match the given type.

    GetAsset(const Guid& id)

    Finds the asset with given ID. Checks all loaded assets.

    Declaration
    public static Asset* GetAsset(const Guid& id)
    Parameters
    Guid id

    The id.

    Returns
    Asset

    The found asset or null if not loaded.

    GetAsset(const StringView& path)

    Finds the asset with at given path. Checks all loaded assets.

    Declaration
    public static Asset* GetAsset(const StringView& path)
    Parameters
    StringView path

    The path.

    Returns
    Asset

    The found asset or null if not loaded.

    GetAssetFactory(const AssetInfo& assetInfo)

    Gets the asset factory used by the given asset type id.

    Declaration
    public static IAssetFactory* GetAssetFactory(const AssetInfo& assetInfo)
    Parameters
    AssetInfo assetInfo

    The asset info.

    Returns
    IAssetFactory

    Asset factory or null if not found.

    GetAssetFactory(const StringView& typeName)

    Gets the asset factory used by the given asset type id.

    Declaration
    public static IAssetFactory* GetAssetFactory(const StringView& typeName)
    Parameters
    StringView typeName

    The asset type name identifier.

    Returns
    IAssetFactory

    Asset factory or null if not found.

    GetAssetInfo(const Guid& id, AssetInfo& info)

    Finds the asset info by id.

    Declaration
    public static bool GetAssetInfo(const Guid& id, AssetInfo& info)
    Parameters
    Guid id

    The asset id.

    AssetInfo info

    The output asset info. Filled with valid values only if method returns true.

    Returns
    bool

    True if found any asset, otherwise false.

    GetAssetInfo(const StringView& path, AssetInfo& info)

    Finds the asset info by path.

    Declaration
    public static bool GetAssetInfo(const StringView& path, AssetInfo& info)
    Parameters
    StringView path

    The asset path.

    AssetInfo info

    The output asset info. Filled with valid values only if method returns true.

    Returns
    bool

    True if found any asset, otherwise false.

    GetAssets()

    Gets the assets (loaded or during load).

    Declaration
    public static Array<Asset* , HeapAllocation> GetAssets()
    Returns
    Array<Asset , HeapAllocation>

    The collection of assets.

    GetAssetsRaw()

    Gets the raw dictionary of assets (loaded or during load).

    Declaration
    public static Dictionary<Guid, Asset* , HeapAllocation> GetAssetsRaw()
    Returns
    Dictionary<Guid, Asset , HeapAllocation>

    The collection of assets.

    GetEditorAssetPath(const Guid& id)

    Finds the asset path by id. In editor it returns the actual asset path, at runtime it returns the mapped asset path.

    Declaration
    public static String GetEditorAssetPath(const Guid& id)
    Parameters
    Guid id

    The asset id.

    Returns
    String

    The asset path, or empty if failed to find.

    GetRegistry()

    Gets the assets registry.

    Declaration
    public static AssetsCache* GetRegistry()
    Returns
    AssetsCache

    The assets cache.

    GetStats()

    Gets content statistics.

    Declaration
    public static ContentStats GetStats()
    Returns
    ContentStats

    IsAssetTypeIdInvalid(const ScriptingTypeHandle& type, const ScriptingTypeHandle& assetType)

    Determines whether input asset type name identifier is invalid.

    Declaration
    public static bool IsAssetTypeIdInvalid(const ScriptingTypeHandle& type, const ScriptingTypeHandle& assetType)
    Parameters
    ScriptingTypeHandle type

    The requested type of the asset to be.

    ScriptingTypeHandle assetType

    The actual type of the asset.

    Returns
    bool

    true if asset type identifier is invalid otherwise, false.

    Load(const Guid& id, double timeoutInMilliseconds=30000.0)

    Loads asset to the Content Pool and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async. Waits until asset will be loaded. It's equivalent to LoadAsync + WaitForLoaded.

    Declaration
    public static T* Load(const Guid& id, double timeoutInMilliseconds=30000.0)
    Parameters
    Guid id

    Asset unique ID.

    double timeoutInMilliseconds

    Custom timeout value in milliseconds.

    Returns
    T

    Asset instance if loaded, null otherwise.

    Type Parameters
    typename T

    Type of the asset to load. Includes any asset types derived from the type.

    Load(const StringView& path, double timeoutInMilliseconds=30000.0)

    Loads asset to the Content Pool and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async. Waits until asset will be loaded. It's equivalent to LoadAsync + WaitForLoaded.

    Declaration
    public static T* Load(const StringView& path, double timeoutInMilliseconds=30000.0)
    Parameters
    StringView path

    The path of the asset (absolute or relative to the current workspace directory).

    double timeoutInMilliseconds

    Custom timeout value in milliseconds.

    Returns
    T

    Asset instance if loaded, null otherwise.

    Type Parameters
    typename T

    Type of the asset to load. Includes any asset types derived from the type.

    LoadAsync(const Guid& id)

    Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static T* LoadAsync(const Guid& id)
    Parameters
    Guid id

    Asset unique ID

    Returns
    T

    Loaded asset or null if cannot

    Type Parameters
    typename T

    Type of the asset to load. Includes any asset types derived from the type.

    LoadAsync(const Guid& id, const MClass* type)

    Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsync(const Guid& id, const MClass* type)
    Parameters
    Guid id

    Asset unique ID

    MClass type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    Loaded asset or null if cannot

    LoadAsync(const Guid& id, const ScriptingTypeHandle& type)

    Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsync(const Guid& id, const ScriptingTypeHandle& type)
    Parameters
    Guid id

    Asset unique ID

    ScriptingTypeHandle type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    Loaded asset or null if cannot

    LoadAsync(const StringView& path)

    Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static T* LoadAsync(const StringView& path)
    Parameters
    StringView path

    The path of the asset (absolute or relative to the current workspace directory).

    Returns
    T

    Loaded asset or null if cannot

    Type Parameters
    typename T

    Type of the asset to load. Includes any asset types derived from the type.

    LoadAsync(const StringView& path, const MClass* type)

    Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsync(const StringView& path, const MClass* type)
    Parameters
    StringView path

    The path of the asset (absolute or relative to the current workspace directory).

    MClass type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    Loaded asset or null if cannot

    LoadAsync(const StringView& path, const ScriptingTypeHandle& type)

    Loads asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsync(const StringView& path, const ScriptingTypeHandle& type)
    Parameters
    StringView path

    The path of the asset (absolute or relative to the current workspace directory).

    ScriptingTypeHandle type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    Loaded asset or null if cannot

    LoadAsyncInternal(const Char* internalPath)

    Loads internal engine asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static T* LoadAsyncInternal(const Char* internalPath)
    Parameters
    Char internalPath

    The path of the asset relative to the engine internal content (excluding the extension).

    Returns
    T

    The loaded asset or null if failed.

    Type Parameters
    typename T

    LoadAsyncInternal(const Char* internalPath, const ScriptingTypeHandle& type)

    Loads internal engine asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsyncInternal(const Char* internalPath, const ScriptingTypeHandle& type)
    Parameters
    Char internalPath

    The path of the asset relative to the engine internal content (excluding the extension).

    ScriptingTypeHandle type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    The loaded asset or null if failed.

    LoadAsyncInternal(const StringView& internalPath, const MClass* type)

    Loads internal engine asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsyncInternal(const StringView& internalPath, const MClass* type)
    Parameters
    StringView internalPath

    The path of the asset relative to the engine internal content (excluding the extension).

    MClass type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    The loaded asset or null if failed.

    LoadAsyncInternal(const StringView& internalPath, const ScriptingTypeHandle& type)

    Loads internal engine asset and holds it until it won't be referenced by any object. Returns null if asset is missing. Actual asset data loading is performed on a other thread in async.

    Declaration
    public static Asset* LoadAsyncInternal(const StringView& internalPath, const ScriptingTypeHandle& type)
    Parameters
    StringView internalPath

    The path of the asset relative to the engine internal content (excluding the extension).

    ScriptingTypeHandle type

    The asset type. If loaded object has different type (excluding types derived from the given) the loading fails.

    Returns
    Asset

    The loaded asset or null if failed.

    RenameAsset(const StringView& oldPath, const StringView& newPath)

    Renames the asset.

    Declaration
    public static bool RenameAsset(const StringView& oldPath, const StringView& newPath)
    Parameters
    StringView oldPath

    The old asset path.

    StringView newPath

    The new asset path.

    Returns
    bool

    True if failed, otherwise false.

    UnloadAsset(Asset* asset)

    Unloads the specified asset.

    Declaration
    public static void UnloadAsset(Asset* asset)
    Parameters
    Asset asset

    The asset.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat