Add asset reload option via context menu in Editor

This commit is contained in:
Wojtek Figat
2023-06-13 14:58:14 +02:00
parent f1c98320fc
commit 13b1c16213
2 changed files with 19 additions and 0 deletions

View File

@@ -23,6 +23,11 @@ namespace FlaxEditor.Content
/// </summary>
public string TypeName { get; }
/// <summary>
/// Returns true if asset is now loaded.
/// </summary>
public bool IsLoaded => FlaxEngine.Content.GetAsset(ID)?.IsLoaded ?? false;
/// <summary>
/// Initializes a new instance of the <see cref="AssetItem"/> class.
/// </summary>
@@ -83,6 +88,18 @@ namespace FlaxEditor.Content
}
}
/// <summary>
/// Reloads the asset (if it's loaded).
/// </summary>
public void Reload()
{
var asset = FlaxEngine.Content.GetAsset(ID);
if (asset != null && asset.IsLoaded)
{
asset.Reload();
}
}
/// <summary>
/// Determines whether asset is of the specified type (included inheritance checks).
/// </summary>