EllanJiang/GameFramework · error · GameFrameworkException

Record interval is invalid.

Error message

Record interval is invalid.

What it means

DownloadCounter's constructor requires a strictly positive record interval — how often the average/max download speed snapshot is recorded. A record interval <= 0 would either never record or divide by zero when computing speed, so the constructor rejects it.

Solutions

  1. Pass a positive recordInterval (e.g. 10f seconds)
  2. Fix the DownloadManager settings in the Inspector/config so record interval > 0
  3. If intervals come from remote config, add a floor (Math.Max(1f, value)) before use

Example fix

// before
var counter = new DownloadCounter(updateInterval, 0f);
// after
var counter = new DownloadCounter(updateInterval, Math.Max(1f, recordInterval));
Defensive patterns

Strategy: validation

Validate before calling

if (recordInterval <= 0f) recordInterval = 10f; // floor before constructing

Type guard

bool IsValidInterval(float seconds) => !float.IsNaN(seconds) && seconds > 0f;

Try / catch

try { var counter = new DownloadCounter(updateInterval, recordInterval); } catch (GameFrameworkException ex) { Log.Error("Download counter config invalid: {0}", ex.Message); }

Prevention

When it happens

Trigger: Constructing DownloadCounter with recordInterval <= 0f, e.g. DownloadCounter(1f, 0f) or a negative value from misparsed settings.

Common situations: DownloadManager settings asset with Record Interval left at 0, copy-pasted config where the interval was accidentally zeroed, or a unit test passing 0 to skip recording.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/fe39dc91f0705aa0. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Download/DownloadManager.DownloadCounter.cs:30

        private sealed partial class DownloadCounter
        {
            private readonly GameFrameworkLinkedList<DownloadCounterNode> m_DownloadCounterNodes;
            private float m_UpdateInterval;
            private float m_RecordInterval;
            private float m_CurrentSpeed;
            private float m_Accumulator;
            private float m_TimeLeft;

            public DownloadCounter(float updateInterval, float recordInterval)
            {
                if (updateInterval <= 0f)
                {
                    throw new GameFrameworkException("Update interval is invalid.");
                }

                if (recordInterval <= 0f)
                {
                    throw new GameFrameworkException("Record interval is invalid.");
                }

                m_DownloadCounterNodes = new GameFrameworkLinkedList<DownloadCounterNode>();
                m_UpdateInterval = updateInterval;
                m_RecordInterval = recordInterval;
                Reset();
            }

            public float UpdateInterval
            {
                get
                {
                    return m_UpdateInterval;
                }
                set
                {
                    if (value <= 0f)
                    {

View on GitHub (pinned to d0c010b051)