Class AssetItem
[DataContract("AssetItem")]
public sealed class AssetItem : IFileSynchronizable
- Inheritance
-
AssetItem
- Implements
- Extension Methods
Constructors
AssetItem(UFile, Asset)
Initializes a new instance of the AssetItem class.
public AssetItem(UFile location, Asset asset)
Parameters
location
UFileThe location inside the package.
asset
AssetThe asset.
Exceptions
- ArgumentNullException
location
- 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
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
- UFile
Asset
Gets or sets the asset.
[DataMember]
public Asset Asset { get; }
Property Value
- 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
- 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
- AssetId
The unique identifier.
IsDeleted
public bool IsDeleted { get; set; }
Property Value
IsDirty
Gets or sets a value indicating whether this instance is dirty. See remarks.
public bool IsDirty { get; set; }
Property Value
- bool
true
if this instance is dirty; otherwise,false
.
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.
[DataMember]
public UFile Location { get; }
Property Value
- UFile
The location.
ModifiedTime
Gets the modified time. See remarks.
[DataMember]
public DateTime ModifiedTime { get; }
Property Value
- 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.
[DataMember]
public Package Package { get; }
Property Value
- 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
- UDirectory
The directory.
Version
Gets the asset version incremental counter, increased everytime the asset is edited.
[DataMember]
public long Version { get; }
Property Value
YamlMetadata
Gets the attached metadata for YAML serialization.
public AttachedYamlAssetMetadata YamlMetadata { get; }
Property Value
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
newLocation
UFileThe new location that will be used in the cloned AssetItem. If this parameter is null, it keeps the original location of the asset.
newAsset
AssetThe 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)
flags
AssetClonerFlagsFlags used with Clone(object, AssetClonerFlags).
Returns
- AssetItem
A clone of this instance.
Clone(bool, 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
keepPackage
boolif set to
true
copy package information, only used by the AssetDependencyManager.newLocation
UFileThe new location that will be used in the cloned AssetItem. If this parameter is null, it keeps the original location of the asset.
newAsset
AssetThe 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)
flags
AssetClonerFlagsFlags used with Clone(object, AssetClonerFlags).
Returns
- AssetItem
A clone of this instance.
CreateDerivedAsset()
Creates a child asset that is inheriting the values of this asset.
public Asset CreateDerivedAsset()
Returns
- 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
- AssetItem
The base item or null if not found.
RetrieveCompilationInputFiles()
public ISet<UFile> RetrieveCompilationInputFiles()
Returns
- ISet<UFile>
ToReference()
Converts this item to a reference.
public AssetReference ToReference()
Returns
- AssetReference
AssetReference.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
UpdateSourceFolders()
In case SourceFolder was null, generates it.
public void UpdateSourceFolders()