Table of Contents

Class AssetRegistry

Namespace
Stride.Core.Assets
Assembly
Stride.Core.Assets.dll

A registry for various content associated with assets.

public static class AssetRegistry
Inheritance
AssetRegistry

Properties

AssetAssemblies

Gets the list of asset assemblies currently registered.

public static IEnumerable<Assembly> AssetAssemblies { get; }

Property Value

IEnumerable<Assembly>

EngineAssemblies

Gets the list of engine assemblies currently registered.

public static IEnumerable<Assembly> EngineAssemblies { get; }

Property Value

IEnumerable<Assembly>

RegisteredImporters

Gets an enumeration of registered importers.

public static IEnumerable<IAssetImporter> RegisteredImporters { get; }

Property Value

IEnumerable<IAssetImporter>

The registered importers.

SupportedPlatforms

Gets the supported platforms.

public static SolutionPlatformCollection SupportedPlatforms { get; }

Property Value

SolutionPlatformCollection

The supported platforms.

Methods

CanBeAssignedToContentTypes(Type, bool)

Can a property of this type hold content

public static bool CanBeAssignedToContentTypes(Type type, bool checkIsUrlType)

Parameters

type Type
checkIsUrlType bool

Returns

bool

Remarks

You may want to use IsExactContentType(Type?) instead if you're checking if this type is a concrete content type

CanPropertyHandleAssets(Type, out HashSet<Type>)

Whether a property of this type can be set to asset content, outputs the assets it can hold if true

public static bool CanPropertyHandleAssets(Type propertyType, out HashSet<Type> assetTypes)

Parameters

propertyType Type
assetTypes HashSet<Type>

Returns

bool

Remarks

The difference between this one and CanPropertyHandleContent(Type, out IReadOnlyList<Type>) is that this one returns the asset types, meaning the types that would be compiled into 'content' to be used at runtime. This means that the types contained in AssetTypes are not directly assignable to propertyType

CanPropertyHandleContent(Type, out IReadOnlyList<Type>)

Whether a property of this type can be set to content, outputs the content types it can hold if true

public static bool CanPropertyHandleContent(Type propertyType, out IReadOnlyList<Type> contentTypes)

Parameters

propertyType Type
contentTypes IReadOnlyList<Type>

Returns

bool

Remarks

The difference between this one and CanPropertyHandleAssets(Type, out HashSet<Type>) is that this one returns the content types, meaning the concrete types that are types that would be compiled into 'content' to be used at runtime. The types contained in contentTypes are not guaranteed to be assignable to propertyType

FindImporterById(Guid)

Finds an importer by its id.

public static IAssetImporter? FindImporterById(Guid importerId)

Parameters

importerId Guid

The importer identifier.

Returns

IAssetImporter

An instance of the importer of null if not found.

FindImporterForFile(string)

Finds the importer associated with an asset by the file of the file to import.

public static IEnumerable<IAssetImporter> FindImporterForFile(string file)

Parameters

file string

The file to import.

Returns

IEnumerable<IAssetImporter>

An instance of the importer of null if not found.

GetAllAssetFactories()

public static IEnumerable<IAssetFactory<Asset>> GetAllAssetFactories()

Returns

IEnumerable<IAssetFactory<Asset>>

GetAssetFactory(string)

public static IAssetFactory<Asset>? GetAssetFactory(string typeName)

Parameters

typeName string

Returns

IAssetFactory<Asset>

GetAssetTypeFromFileExtension(string)

Gets the asset type from the extension. If no asset type is found, return null.

public static Type? GetAssetTypeFromFileExtension(string extension)

Parameters

extension string

The extension of the asset file.

Returns

Type

Type of the associated asset or null if not found.

GetAssetTypes(Type)

public static IReadOnlyList<Type> GetAssetTypes(Type contentType)

Parameters

contentType Type

Returns

IReadOnlyList<Type>

GetAssetUpgraders(Type, string)

Gets the AssetUpgraderCollection of an asset type, if available.

public static AssetUpgraderCollection? GetAssetUpgraders(Type assetType, string dependencyName)

Parameters

assetType Type

The asset type.

dependencyName string

The dependency name.

Returns

AssetUpgraderCollection

The AssetUpgraderCollection of an asset type if available, or null otherwise.

GetContentType(Type)

public static Type? GetContentType(Type assetType)

Parameters

assetType Type

Returns

Type

GetContentTypes()

public static IList<Type> GetContentTypes()

Returns

IList<Type>

GetCurrentFormatVersions(Type)

Gets the current format version of an asset.

public static SortedList<string, PackageVersion>? GetCurrentFormatVersions(Type assetType)

Parameters

assetType Type

The asset type.

Returns

SortedList<string, PackageVersion>

The current format version of this asset.

GetDataVisitNodes()

public static IEnumerable<IDataCustomVisitor> GetDataVisitNodes()

Returns

IEnumerable<IDataCustomVisitor>

GetDefaultExtension(Type)

Gets the default file associated with an asset.

public static string? GetDefaultExtension(Type assetType)

Parameters

assetType Type

The type.

Returns

string

System.String.

GetDefaultExtension<T>()

Gets the default file associated with an asset.

public static string? GetDefaultExtension<T>() where T : Asset

Returns

string

System.String.

Type Parameters

T

Type of the asset.

GetPackageSessionAnalysisTypes()

public static IEnumerable<Type> GetPackageSessionAnalysisTypes()

Returns

IEnumerable<Type>

GetPackageUpgrader(string)

public static PackageUpgrader? GetPackageUpgrader(string packageName)

Parameters

packageName string

Returns

PackageUpgrader

GetPublicTypes()

Returns an array of asset types that are non-abstract and public.

public static Type[] GetPublicTypes()

Returns

Type[]

An array of Type elements.

IsAssetFileExtension(string?)

Determines whether the file is an asset file type.

public static bool IsAssetFileExtension(string? extension)

Parameters

extension string

The file.

Returns

bool

true if [is asset file file] [the specified file]; otherwise, false.

IsAssetOrPackageType(Type, bool)

Check if the specified type is an asset.

public static bool IsAssetOrPackageType(Type assetType, bool throwException = false)

Parameters

assetType Type

Type of the asset.

throwException bool

A boolean indicating whether this method should throw an exception if the type is not an asset type.

Returns

bool

true if the asset is an asset type, false otherwise.

IsAssetType(Type, bool)

Check if the specified type is an asset.

public static bool IsAssetType(Type assetType, bool throwException = false)

Parameters

assetType Type

Type of the asset.

throwException bool

A boolean indicating whether this method should throw an exception if the type is not an asset type.

Returns

bool

true if the asset is an asset type, false otherwise.

IsAssetTypeAlwaysMarkAsRoot(Type)

public static bool IsAssetTypeAlwaysMarkAsRoot(Type type)

Parameters

type Type

Returns

bool

IsExactContentType(Type?)

Is this type a concrete content type, or derives from a concrete content type

public static bool IsExactContentType(Type? type)

Parameters

type Type

Returns

bool

Remarks

You may want to use CanBeAssignedToContentTypes(Type, bool) instead if you're checking whether a property of this type could hold at least one type of content

IsProjectAssetFileExtension(string?)

public static bool IsProjectAssetFileExtension(string? extension)

Parameters

extension string

Returns

bool

IsProjectCodeGeneratorAssetFileExtension(string?)

public static bool IsProjectCodeGeneratorAssetFileExtension(string? extension)

Parameters

extension string

Returns

bool

RegisterImporter(IAssetImporter)

Registers a IAssetImporter for the specified asset type.

public static void RegisterImporter(IAssetImporter importer)

Parameters

importer IAssetImporter

The importer.

Exceptions

ArgumentNullException

importer

RegisterSupportedPlatforms(List<SolutionPlatform>)

Registers the supported platforms.

public static void RegisterSupportedPlatforms(List<SolutionPlatform> platforms)

Parameters

platforms List<SolutionPlatform>

The platforms.

Exceptions

ArgumentNullException

platforms