Table of Contents

Class AssetReference

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

An asset reference.

[DataContract("aref")]
[DataStyle(DataStyle.Compact)]
[DataSerializer(typeof(AssetReferenceDataSerializer))]
public sealed class AssetReference : IReference, IEquatable<AssetReference>
Inheritance
AssetReference
Implements
Extension Methods

Constructors

AssetReference(AssetId, UFile)

Initializes a new instance of the AssetReference class.

public AssetReference(AssetId id, UFile location)

Parameters

id AssetId

The unique identifier of the asset.

location UFile

The location.

Properties

Id

Gets or sets the unique identifier of the reference asset.

[DataMember(10)]
public AssetId Id { get; init; }

Property Value

AssetId

The unique identifier of the reference asset..

Location

Gets or sets the location of the asset.

[DataMember(20)]
public string Location { get; init; }

Property Value

string

The location.

Methods

Equals(AssetReference)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(AssetReference other)

Parameters

other AssetReference

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

New(AssetId, UFile)

Tries to parse an asset reference in the format "GUID:Location".

public static AssetReference New(AssetId id, UFile location)

Parameters

id AssetId

The identifier.

location UFile

The location.

Returns

AssetReference

true if parsing was successful, false otherwise.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

TryParse(string, out AssetId, out UFile)

Tries to parse an asset reference in the format "[GUID/]GUID:Location". The first GUID is optional and is used to store the ID of the reference.

public static bool TryParse(string assetReferenceText, out AssetId id, out UFile location)

Parameters

assetReferenceText string

The asset reference.

id AssetId

The unique identifier of asset pointed by this reference.

location UFile

The location.

Returns

bool

true if parsing was successful, false otherwise.

Exceptions

ArgumentNullException

assetReferenceText

TryParse(string, out AssetReference)

Tries to parse an asset reference in the format "GUID:Location".

public static bool TryParse(string assetReferenceText, out AssetReference assetReference)

Parameters

assetReferenceText string

The asset reference.

assetReference AssetReference

The reference.

Returns

bool

true if parsing was successful, false otherwise.

Operators

operator ==(AssetReference, AssetReference)

Implements the ==.

public static bool operator ==(AssetReference left, AssetReference right)

Parameters

left AssetReference

The left.

right AssetReference

The right.

Returns

bool

The result of the operator.

operator !=(AssetReference, AssetReference)

Implements the !=.

public static bool operator !=(AssetReference left, AssetReference right)

Parameters

left AssetReference

The left.

right AssetReference

The right.

Returns

bool

The result of the operator.