Skip to content

API reference

Struct AssetKey

Namespace: MicroEngine.Content
Assembly: MicroEngine.Content.dll
Guide: Assets

What identifies a stored asset: the loader’s kind, the content path and the settings it was loaded with. Two requests with equal keys share one object. A struct of references and values, so a lookup allocates nothing.

C#
public readonly struct AssetKey : IEquatable<AssetKey>

Implements

IEquatable<AssetKey>

Constructors

AssetKey(string, string, object?, long)

What identifies a stored asset: the loader’s kind, the content path and the settings it was loaded with. Two requests with equal keys share one object. A struct of references and values, so a lookup allocates nothing.

C#
public AssetKey(string Kind, string Path, object? Options = null, long Variant = 0)

Parameters

Kind string

The kind of the loader that makes it (“texture”, “sound”…; see AssetLoaderRegistry).

Path string

The path in the content source, ‘/’-separated (normalized by the store, see Normalize).

Options object?

Load settings compared by value (a record), or null for the loader’s defaults.

Variant long

A small value that also tells loads apart (a sampling filter, for example) without boxing it.

Properties

Kind

The kind of the loader that makes it (“texture”, “sound”…; see AssetLoaderRegistry).

C#
public string Kind { get; init; }

Property Value

string

Options

Load settings compared by value (a record), or null for the loader’s defaults.

C#
public object? Options { get; init; }

Property Value

object?

Path

The path in the content source, ‘/’-separated (normalized by the store, see Normalize).

C#
public string Path { get; init; }

Property Value

string

Variant

A small value that also tells loads apart (a sampling filter, for example) without boxing it.

C#
public long Variant { get; init; }

Property Value

long

Methods

Deconstruct(out string, out string, out object?, out long)

C#
public void Deconstruct(out string Kind, out string Path, out object? Options, out long Variant)

Parameters

Kind string

Path string

Options object?

Variant long

Equals(object)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(AssetKey)

C#
public bool Equals(AssetKey other)

Parameters

other AssetKey

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

“kind ‘path’” for messages.

C#
public override string ToString()

Returns

string

Operators

operator ==(AssetKey, AssetKey)

C#
public static bool operator ==(AssetKey left, AssetKey right)

Parameters

left AssetKey

right AssetKey

Returns

bool

operator !=(AssetKey, AssetKey)

C#
public static bool operator !=(AssetKey left, AssetKey right)

Parameters

left AssetKey

right AssetKey

Returns

bool