robot_2Generated
code_blocksInput

Description

The OnHighlight field is an event handler of type System.Action<System.Object> in the Editor.AssetList class. It is triggered when the selection of assets in the asset list changes. This allows developers to execute custom logic whenever an asset is highlighted or selected within the editor's asset list.

Usage

To use the OnHighlight event, you can subscribe a method to it that matches the signature of System.Action<System.Object>. This method will be called with the selected object as its parameter whenever the selection changes.

Example

// Example of subscribing to the OnHighlight event

Editor.AssetList assetList = new Editor.AssetList();

// Define a method to handle the highlight event
void OnAssetHighlighted(object selectedAsset)
{
    // Implement custom logic for when an asset is highlighted
    // For example, update UI or log the selected asset
    // selectedAsset could be an Editor.Asset or System.IO.DirectoryInfo
}

// Subscribe the method to the OnHighlight event
assetList.OnHighlight += OnAssetHighlighted;

// Later, you can unsubscribe if needed
// assetList.OnHighlight -= OnAssetHighlighted;