Table of Contents

Class DLCAsset

Namespace
DLCToolkit.Assets
Assembly
DLCToolkit.dll

Represents a specific asset included in the DLC. Provides access to useful metadata such as name, path, extension, type and more which can be quickly accessed without forcing the asset to be loaded into memory. Note that this can represent shared assets and scene assets in the same form.

public abstract class DLCAsset
Inheritance
DLCAsset
Derived

Fields

assetID

The unique ID for this asset.

protected int assetID

Field Value

int

assetType

The type of this asset.

protected Type assetType

Field Value

Type

extension

The file extension of the asset.

protected string extension

Field Value

string

fullName

The full name relative to the original Unity project assets folder of the asset.

protected string fullName

Field Value

string

name

The name of the asset.

protected string name

Field Value

string

relativeName

The relative name relative to the original DLC content folder of the asset.

protected string relativeName

Field Value

string

Properties

AssetID

The unique id for this asset. This is guaranteed to be unique during the current session. Id's are not persistent.

public int AssetID { get; }

Property Value

int

AssetMainType

Get the type of the main asset. For example this value will be GameObject when dealing with a prefab asset, or Texture2D when dealing with a texture.

public Type AssetMainType { get; }

Property Value

Type

Extension

Get the extension of the asset, For example: '.prefab'. The extension will always begin with a '.'.

public string Extension { get; }

Property Value

string

FullName

Get the full name of the asset. The full name is defined as the asset path relative the the export project folder including the asset extension, For example: 'assets/mydlc/subfolder/cube.prefab'.

public string FullName { get; }

Property Value

string

IsBundleLoaded

Check if the containing bundle is currently loaded in memory. If false, any load requests issued may take longer than expected as the containing bundle will first need to be loaded.

public bool IsBundleLoaded { get; }

Property Value

bool

IsLoadable

Check if the asset can be loaded into memory. Only possible when the DLC content has been fully loaded as opposed to partially loaded using a method such as LoadDLCMetadataWithAssets(string).

public bool IsLoadable { get; }

Property Value

bool

IsLoaded

Check if the asset is currently loaded in memory.

public bool IsLoaded { get; }

Property Value

bool

Name

Get the name of the asset.

public string Name { get; }

Property Value

string

RelativeName

Get the relative name of the asset. The relative name is defined as the asset path relative to the mod folder without the asset extension, For example: 'subfolder/cube'. If the asset is not in a sub folder then the value wil be equal to Name.

public string RelativeName { get; }

Property Value

string

Methods

IsAssetSubType(Type)

Check if this asset is of the specified type or is derived from the specified type. For example: A Texture2D asset will return true if UnityEngine.Object is passed as the parameter type, since textures derive from the base object type.

public bool IsAssetSubType(Type type)

Parameters

type Type

The type to check for equality or derivation

Returns

bool

True if the asset is of the specified type, or is derived from the specified type otherwise false

IsAssetSubType<T>()

Check if this asset is of the specified generic type or is derived from the specified type. For example: A Texture2D asset will return true if UnityEngine.Object is passed as the parameter type, since textures derive from the base object type.

public bool IsAssetSubType<T>()

Returns

bool

True if the asset is of the specified generic type, or is derived from the specified type otherwise false

Type Parameters

T

The generic type to check for equality or derivation

IsAssetType(Type)

Check if this asset is of the specified type. Note that this will not check for derived types and you can use IsAssetSubType(Type) instead.

public bool IsAssetType(Type type)

Parameters

type Type

The type to check for equality

Returns

bool

True if the asset is of specified type of false if not

IsAssetType<T>()

Check if this asset is of the specified generic type. Note that this will not check for derived types and you can use IsAssetSubType<T>() instead.

public bool IsAssetType<T>()

Returns

bool

True if the asset is of specified generic type of false if not

Type Parameters

T

The generic type to check for equality

ToString()

Convert to string representation.

public override string ToString()

Returns

string

This asset as a string