static bool PlayAssetSound( Asset asset )
static bool PlayAssetSound( SoundEvent file )
static bool PlayAssetSound( SoundFile file )

robot_2Generated
code_blocksInput

Description

The PlayAssetSound method in the Editor.EditorUtility class is a static method used to play a sound from a specified asset. This method is useful for previewing audio assets directly within the editor environment.

Usage

To use the PlayAssetSound method, you need to pass an Editor.Asset object that represents the sound asset you wish to play. The method returns a bool indicating whether the sound was successfully played.

Example

// Example of using PlayAssetSound
Editor.Asset soundAsset = Editor.Asset.Load("path/to/sound.asset");
bool isPlaying = Editor.EditorUtility.PlayAssetSound(soundAsset);

if (isPlaying)
{
    // Sound is playing
}
else
{
    // Failed to play sound
}