---
title: "Event Throttling"
description: "Learn how to limit repeated errors, breadcrumbs, and logs from Unity's logging system."
url: https://docs.sentry.io/platforms/unity/configuration/event-debouncing/
last_updated: 2026-11-16T12:24:03.000Z
---

# Event Throttling for Unity

A game can log the same error every frame. Throttling drops the repeats, so they don't use up your quota.

Throttling is off by default.

## [Configure Throttling in the Editor](https://docs.sentry.io/platforms/unity/configuration/event-debouncing.md#configure-throttling-in-the-editor)

Open **Tools > Sentry > Logging** and turn on **Enable Error Event Throttling**. **Dedupe Window \[ms]** sets how long the SDK waits before it captures the same error again. The default is `1000` milliseconds.

The built-in throttler handles errors from `Debug.LogError`, `Debug.LogException`, and, in the editor and development builds, `Debug.LogAssertion`. It treats two errors as the same when their message and stack trace match, and remembers the last 100 distinct errors. It doesn't throttle breadcrumbs or structured logs.

## [Configure Throttling in Code](https://docs.sentry.io/platforms/unity/configuration/event-debouncing.md#configure-throttling-in-code)

To throttle in code, implement `IThrottler` and set it as the [`Throttler`](https://docs.sentry.io/platforms/unity/configuration/options.md#Throttler) option. A custom throttler can also throttle breadcrumbs and structured logs. If you set a throttler in code, the SDK uses it instead of the editor settings.

This example drops any error, breadcrumb, or log that repeats within five seconds. The SDK can call the throttler from any thread, so make it thread-safe and don't call Unity APIs in it.

```csharp
using System;
using System.Collections.Generic;
using Sentry.Unity;
using UnityEngine;

public class RepeatThrottler : IThrottler
{
    private static readonly TimeSpan Window = TimeSpan.FromSeconds(5);
    private readonly Dictionary<string, DateTime> _lastSeen = new Dictionary<string, DateTime>();

    public bool ShouldCaptureEvent(string message, string stackTrace, LogType logType) =>
        ShouldCapture("event:" + message + stackTrace);

    public bool ShouldCaptureException(Exception exception) =>
        ShouldCapture("exception:" + exception.GetType().FullName + exception.Message + exception.StackTrace);

    public bool ShouldCaptureBreadcrumb(string message, LogType logType) =>
        ShouldCapture("breadcrumb:" + message);

    public bool ShouldCaptureStructuredLog(string message, LogType logType) =>
        ShouldCapture("log:" + message);

    private bool ShouldCapture(string key)
    {
        lock (_lastSeen)
        {
            var now = DateTime.UtcNow;
            if (_lastSeen.TryGetValue(key, out var last) && now - last < Window)
            {
                return false;
            }

            if (_lastSeen.Count >= 100)
            {
                // Forget entries whose window has passed.
                var expired = new List<string>();
                foreach (var entry in _lastSeen)
                {
                    if (now - entry.Value >= Window)
                    {
                        expired.Add(entry.Key);
                    }
                }

                foreach (var expiredKey in expired)
                {
                    _lastSeen.Remove(expiredKey);
                }

                if (_lastSeen.Count >= 100)
                {
                    // Still full: capture without tracking.
                    return true;
                }
            }

            _lastSeen[key] = now;
            return true;
        }
    }
}
```

Set it in your [options configuration script](https://docs.sentry.io/platforms/unity/configuration/options/programmatic-configuration.md):

```csharp
public override void Configure(SentryUnityOptions options)
{
    options.Throttler = new RepeatThrottler();
}
```

`EnableLogDebouncing` and the `DebounceTime*` options are deprecated. Use `Throttler` instead.

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
