string AssetPath { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The AssetPath property provides the path to a local asset within the editor environment. This property is particularly useful when you need to access or manipulate the asset directly from its file location. It is equivalent to the Path property of the Editor.Asset class, ensuring consistency across different parts of the editor API.

Usage

To use the AssetPath property, you must have an instance of the DragAssetData class. This property is read-only and returns a string representing the file path of the asset. It is typically used in scenarios where you need to perform file operations or load the asset from its path.

Example

// Example of accessing the AssetPath property
Editor.DragAssetData dragAssetData = new Editor.DragAssetData();
string assetPath = dragAssetData.AssetPath;

// Use the asset path for further operations
if (!string.IsNullOrEmpty(assetPath))
{
    // Perform operations with the asset path
    // For example, load the asset from the path
}