System.Action OnViewModeChanged

robot_2Generated
code_blocksInput

Description

The OnViewModeChanged field is an event handler of type System.Action in the Editor.AssetList class. It is invoked whenever the view mode of the asset list is changed by user interaction. This allows developers to attach custom logic that should be executed in response to changes in the view mode.

Usage

To use the OnViewModeChanged event, you can subscribe a method to it that will be called whenever the view mode changes. This is useful for updating UI elements or performing other actions in response to the view mode change.

Example

// Example of subscribing to the OnViewModeChanged event

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

// Define a method to handle the event
void HandleViewModeChanged()
{
    // Custom logic to execute when the view mode changes
    // For example, update UI elements or log the change
    Console.WriteLine("View mode has been changed.");
}

// Subscribe the method to the event
assetList.OnViewModeChanged += HandleViewModeChanged;

// Later, when the view mode changes, HandleViewModeChanged will be called