Unity-Technologies/UnityCsReference · error · ArgumentException

Clip {clip}'s overview preview is null

Error message

Clip {clip}'s overview preview is null

What it means

ArgumentException thrown when AudioClipMinMaxOverview.GetOverviewFor(clip) returns null after the null-check on clip passes. This means the overview generation system could not produce a min/max amplitude overview for the given clip, possibly because the clip has no audio data, failed import, or the overview cache is unavailable.

Source

Thrown at Editor/Mono/Audio/StreamedAudioClipPreview.cs:71

            {
                if (size < 2)
                    throw new ArgumentException("Size has to be larger than 1");

                if (localLength <= 0)
                    throw new ArgumentException("length has to be longer than zero", "localLength");

                if (localStart < 0)
                    throw new ArgumentException("localStart has to be positive", "localStart");

                if (clip == null)
                    throw new ArgumentNullException("clip");

                this.clip = clip;

                preview = AudioClipMinMaxOverview.GetOverviewFor(clip);

                if (preview == null)
                    throw new ArgumentException("Clip " + clip + "'s overview preview is null");

                looping = isLooping;

                this.localStart = localStart;
                this.localLength = localLength;

                if (looping)
                {
                    previewPixelsToRender = size;
                }
                else
                {
                    var clampedLength = Math.Min(clip.length - localStart, localLength);
                    previewPixelsToRender = (int)Math.Min(size, size * Math.Max(0, clampedLength / localLength));
                }

                previewSamples = preview.Length / (clip.channels * 2);
                normalizedDuration = localLength / clip.length;

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Check if AudioClipMinMaxOverview.GetOverviewFor returns null before constructing ClipPreviewDetails.
  2. Ensure the AudioClip has been fully imported (check AssetDatabase.IsMainAsset or clip.loadState).
  3. Verify the clip has non-zero length and valid audio data.
  4. Skip preview rendering and show a fallback message or placeholder when overview is unavailable.

Example fix

// before
var details = new ClipPreviewDetails(clip, looping, size, start, length);
// after
var overview = AudioClipMinMaxOverview.GetOverviewFor(clip);
if (overview == null)
{
    // clip not ready or has no audio data
    return;
}
var details = new ClipPreviewDetails(clip, looping, size, start, length);
Defensive patterns

Strategy: validation

Validate before calling

// Check overview availability before constructing ClipPreviewDetails
var overview = AudioClipMinMaxOverview.GetOverviewFor(clip);
if (overview == null)
{
    // Clip not ready or has no audio data; skip preview
    return;
}
var details = new ClipPreviewDetails(clip, looping, size, localStart, localLength);

Prevention

When it happens

Trigger: Constructing ClipPreviewDetails with a clip that passes the null check but for which the overview system cannot generate a preview. Occurs with clips that have no samples, clips still being imported, very short clips, or clips with unsupported formats.

Common situations: AudioClips with zero-length audio data, clips in the process of being imported (not yet ready), corrupted audio files that imported with warnings but no usable data, clips with non-standard channel configurations, editor startup before the overview cache is initialized.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/1350f2583def58d0. Report an issue: GitHub.