Class SerenityEditorAudioPreview
Thin editor-only helper that auditions an UnityEngine.AudioClip in the Inspector by driving Unity's
internal UnityEditor.AudioUtil through reflection.
Lets audio designers hear a clip/track without entering Play mode. The internal API's method names differ
between Unity versions (PlayPreviewClip/StopAllPreviewClips on newer, PlayClip/
StopAllClips on older), so the methods are resolved by name with their arguments adapted to the
resolved signature, and every call fails soft if the API cannot be found.
Inherited Members
Namespace: Serenity.AudioPlayer.Infrastructure.Settings.Editor
Assembly: Serenity.UnityAudioPlayer.Infrastructure.Editor.dll
Syntax
public static class SerenityEditorAudioPreview
Properties
IsAvailable
True when the internal preview API was located and auditioning is possible.
Declaration
public static bool IsAvailable { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
DrawPreviewControls(AudioClip)
Draws a compact "Preview" row with Play / Stop buttons for the given clip, disabled when no clip is assigned or the internal preview API is unavailable.
Declaration
public static void DrawPreviewControls(AudioClip clip)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioClip | clip | The clip to audition. |
Play(AudioClip)
Plays a one-shot preview of the clip, stopping any clip already previewing.
Declaration
public static void Play(AudioClip clip)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioClip | clip | The clip to audition; ignored when null. |
StopAll()
Stops every clip currently being previewed.
Declaration
public static void StopAll()