AssetReference Class
Namespace: Stride.Core.AssetsAssembly: Stride.Core.Assets.dll
An asset reference.
[DataContract("aref")]
[DataStyle(DataStyle.Compact)]
[DataSerializer(typeof(AssetReferenceDataSerializer))]
public sealed class AssetReference : IReference, IEquatable<AssetReference>
Name | Description | |
---|---|---|
Constructors | ||
AssetReference(AssetId, UFile) | Initializes a new instance of the AssetReference class. |
|
Properties | ||
Id | Gets or sets the unique identifier of the reference asset. |
|
Location | Gets or sets the location of the asset. |
|
Methods | ||
Equals(AssetReference) | ||
Equals(Object) | ||
GetHashCode() | ||
New(AssetId, UFile) | Tries to parse an asset reference in the format "GUID:Location". |
|
ToString() | ||
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. |
|
TryParse(String, out AssetReference) | Tries to parse an asset reference in the format "GUID:Location". |
|
Operators | ||
Equality(AssetReference, AssetReference) | Implements the ==. |
|
Inequality(AssetReference, AssetReference) | Implements the !=. |
Constructors
AssetReference(AssetId, UFile)
Initializes a new instance of the AssetReference class.
public AssetReference(AssetId id, UFile location)
Parameters
Type | Name | Description |
---|---|---|
AssetId | id | The unique identifier of the asset. |
Stride.Core.IO.UFile | location | The location. |
Properties
Id
Gets or sets the unique identifier of the reference asset.
[DataMember(10)]
public AssetId Id { get; }
Property Value
Type | Description |
---|---|
AssetId | The unique identifier of the reference asset.. |
Location
Gets or sets the location of the asset.
[DataMember(20)]
public string Location { get; }
Property Value
Type | Description |
---|---|
System.String | The location. |
Methods
Equals(AssetReference)
public bool Equals(AssetReference other)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
New(AssetId, UFile)
Tries to parse an asset reference in the format "GUID:Location".
public static AssetReference New(AssetId id, UFile location)
Parameters
Type | Name | Description |
---|---|---|
AssetId | id | The identifier. |
Stride.Core.IO.UFile | location | The location. |
Returns
Type | Description |
---|---|
AssetReference |
|
ToString()
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
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
Type | Name | Description |
---|---|---|
System.String | assetReferenceText | The asset reference. |
AssetId | id | The unique identifier of asset pointed by this reference. |
Stride.Core.IO.UFile | location | The location. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
System.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
Type | Name | Description |
---|---|---|
System.String | assetReferenceText | The asset reference. |
AssetReference | assetReference | The reference. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Operators
Equality(AssetReference, AssetReference)
Implements the ==.
public static bool operator ==(AssetReference left, AssetReference right)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | left | The left. |
AssetReference | right | The right. |
Returns
Type | Description |
---|---|
System.Boolean | The result of the operator. |
Inequality(AssetReference, AssetReference)
Implements the !=.
public static bool operator !=(AssetReference left, AssetReference right)
Parameters
Type | Name | Description |
---|---|---|
AssetReference | left | The left. |
AssetReference | right | The right. |
Returns
Type | Description |
---|---|
System.Boolean | The result of the operator. |