AssetItem Class
Namespace: Stride.Core.AssetsAssembly: Stride.Core.Assets.dll
[DataContract("AssetItem")]
public sealed class AssetItem : IFileSynchronizable
              | Name | Description | |
|---|---|---|
| Constructors | ||
| AssetItem(UFile, Asset) | Initializes a new instance of the AssetItem class.  | 
                          |
| Fields | ||
| DefaultComparerById | The default comparer use only the id of an assetitem to match assets.  | 
                          |
| Properties | ||
| AlternativePath | Gets or sets the real location of this asset if it is overriden (similar to   | 
                          |
| Asset | Gets or sets the asset.  | 
                          |
| FullPath | Gets the full absolute path of this asset on the disk, taking into account the SourceFolder, and the RootDirectory. See remarks.  | 
                          |
| Id | Gets the unique identifier of this asset.  | 
                          |
| IsDeleted | ||
| IsDirty | Gets or sets a value indicating whether this instance is dirty. See remarks.  | 
                          |
| Location | Gets the location of this asset.  | 
                          |
| ModifiedTime | Gets the modified time. See remarks.  | 
                          |
| Package | Gets the package where this asset is stored.  | 
                          |
| SourceFolder | Gets the directory where the assets will be stored on the disk relative to the Package. The directory will update the list found in AssetFolders  | 
                          |
| Version | Gets the asset version incremental counter, increased everytime the asset is edited.  | 
                          |
| YamlMetadata | Gets the attached metadata for YAML serialization.  | 
                          |
| Methods | ||
| Clone(UFile, Asset, AssetClonerFlags) | Clones this instance without the attached package.  | 
                          |
| Clone(Boolean, UFile, Asset, AssetClonerFlags) | Clones this instance without the attached package.  | 
                          |
| CreateDerivedAsset() | Creates a child asset that is inheriting the values of this asset.  | 
                          |
| FindBase() | Finds the base item referenced by this item from the current session (using the Package setup on this instance)  | 
                          |
| RetrieveCompilationInputFiles() | ||
| ToReference() | Converts this item to a reference.  | 
                          |
| ToString() | ||
| UpdateSourceFolders() | In case SourceFolder was null, generates it.  | 
                          |
Constructors
AssetItem(UFile, Asset)
Initializes a new instance of the AssetItem class.
public AssetItem(UFile location, Asset asset)
              Parameters
| Type | Name | Description | 
|---|---|---|
| Stride.Core.IO.UFile | location | The location inside the package.  | 
                  
| Asset | asset | The asset.  | 
                  
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | location  | 
                  
| System.ArgumentNullException | asset  | 
                  
Fields
DefaultComparerById
The default comparer use only the id of an assetitem to match assets.
public static readonly IEqualityComparer<AssetItem> DefaultComparerById
              Field Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IEqualityComparer<AssetItem> | 
Properties
AlternativePath
Gets or sets the real location of this asset if it is overriden (similar to Link in C# project files).
public UFile AlternativePath { get; set; }
              Property Value
| Type | Description | 
|---|---|
| Stride.Core.IO.UFile | 
Asset
Gets or sets the asset.
public Asset Asset { get; }
              Property Value
| Type | Description | 
|---|---|
| Asset | The asset.  | 
                  
FullPath
Gets the full absolute path of this asset on the disk, taking into account the SourceFolder, and the RootDirectory. See remarks.
public UFile FullPath { get; }
              Property Value
| Type | Description | 
|---|---|
| Stride.Core.IO.UFile | The full absolute path of this asset on the disk.  | 
                  
Remarks
This value is only valid if this instance is attached to a Package, and that the package has a non null RootDirectory.
Id
Gets the unique identifier of this asset.
public AssetId Id { get; }
              Property Value
| Type | Description | 
|---|---|
| AssetId | The unique identifier.  | 
                  
IsDeleted
public bool IsDeleted { get; set; }
              Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsDirty
Gets or sets a value indicating whether this instance is dirty. See remarks.
public bool IsDirty { get; set; }
              Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
                  
Remarks
When an asset is modified, this property must be set to true in order to track assets changes.
Location
Gets the location of this asset.
public UFile Location { get; }
              Property Value
| Type | Description | 
|---|---|
| Stride.Core.IO.UFile | The location.  | 
                  
ModifiedTime
Gets the modified time. See remarks.
public DateTime ModifiedTime { get; }
              Property Value
| Type | Description | 
|---|---|
| System.DateTime | The modified time.  | 
                  
Remarks
By default, contains the last modified time of the asset from the disk. If IsDirty is also updated from false to true , this time will get current time of modification.
Package
Gets the package where this asset is stored.
public Package Package { get; }
              Property Value
| Type | Description | 
|---|---|
| Package | The package.  | 
                  
SourceFolder
Gets the directory where the assets will be stored on the disk relative to the Package. The directory will update the list found in AssetFolders
public UDirectory SourceFolder { get; set; }
              Property Value
| Type | Description | 
|---|---|
| Stride.Core.IO.UDirectory | The directory.  | 
                  
Version
Gets the asset version incremental counter, increased everytime the asset is edited.
public long Version { get; }
              Property Value
| Type | Description | 
|---|---|
| System.Int64 | 
YamlMetadata
Gets the attached metadata for YAML serialization.
public AttachedYamlAssetMetadata YamlMetadata { get; }
              Property Value
| Type | Description | 
|---|---|
| AttachedYamlAssetMetadata | 
Methods
Clone(UFile, Asset, AssetClonerFlags)
Clones this instance without the attached package.
public AssetItem Clone(UFile newLocation = null, Asset newAsset = null, AssetClonerFlags flags = AssetClonerFlags.None)
              Parameters
| Type | Name | Description | 
|---|---|---|
| Stride.Core.IO.UFile | newLocation | The new location that will be used in the cloned AssetItem. If this parameter is null, it keeps the original location of the asset.  | 
                  
| Asset | newAsset | The new asset that will be used in the cloned AssetItem. If this parameter is null, it clones the original asset. otherwise, the specified asset is used as-is in the new AssetItem (no clone on newAsset is performed)  | 
                  
| AssetClonerFlags | flags | Flags used with Stride.Core.Assets.AssetCloner.Clone(System.Collections.Generic.Dictionary{System.Guid,System.Guid}@).  | 
                  
Returns
| Type | Description | 
|---|---|
| AssetItem | A clone of this instance.  | 
                  
Clone(Boolean, UFile, Asset, AssetClonerFlags)
Clones this instance without the attached package.
public AssetItem Clone(bool keepPackage, UFile newLocation = null, Asset newAsset = null, AssetClonerFlags flags = AssetClonerFlags.None)
              Parameters
| Type | Name | Description | 
|---|---|---|
| System.Boolean | keepPackage | if set to   | 
                  
| Stride.Core.IO.UFile | newLocation | The new location that will be used in the cloned AssetItem. If this parameter is null, it keeps the original location of the asset.  | 
                  
| Asset | newAsset | The new asset that will be used in the cloned AssetItem. If this parameter is null, it clones the original asset. otherwise, the specified asset is used as-is in the new AssetItem (no clone on newAsset is performed)  | 
                  
| AssetClonerFlags | flags | Flags used with Stride.Core.Assets.AssetCloner.Clone(System.Collections.Generic.Dictionary{System.Guid,System.Guid}@).  | 
                  
Returns
| Type | Description | 
|---|---|
| AssetItem | A clone of this instance.  | 
                  
CreateDerivedAsset()
Creates a child asset that is inheriting the values of this asset.
public Asset CreateDerivedAsset()
              Returns
| Type | Description | 
|---|---|
| Asset | A new asset inheriting the values of this asset.  | 
                  
FindBase()
Finds the base item referenced by this item from the current session (using the Package setup on this instance)
public AssetItem FindBase()
              Returns
| Type | Description | 
|---|---|
| AssetItem | The base item or null if not found.  | 
                  
RetrieveCompilationInputFiles()
public ISet<UFile> RetrieveCompilationInputFiles()
              Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.ISet<Stride.Core.IO.UFile> | 
ToReference()
Converts this item to a reference.
public AssetReference ToReference()
              Returns
| Type | Description | 
|---|---|
| AssetReference | AssetReference.  | 
                  
ToString()
public override string ToString()
              Returns
| Type | Description | 
|---|---|
| System.String | 
Overrides
UpdateSourceFolders()
In case SourceFolder was null, generates it.
public void UpdateSourceFolders()