{"record":{"id":"cfd8c155df8afbc4","repo":"EllanJiang/GameFramework","slug":"update-interval-is-invalid","errorCode":null,"errorMessage":"Update interval is invalid.","messagePattern":"Update interval is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Download/DownloadManager.DownloadCounter.cs","lineNumber":25,"sourceCode":"\nnamespace GameFramework.Download\n{\n    internal sealed partial class DownloadManager : GameFrameworkModule, IDownloadManager\n    {\n        private sealed partial class DownloadCounter\n        {\n            private readonly GameFrameworkLinkedList<DownloadCounterNode> m_DownloadCounterNodes;\n            private float m_UpdateInterval;\n            private float m_RecordInterval;\n            private float m_CurrentSpeed;\n            private float m_Accumulator;\n            private float m_TimeLeft;\n\n            public DownloadCounter(float updateInterval, float recordInterval)\n            {\n                if (updateInterval <= 0f)\n                {\n                    throw new GameFrameworkException(\"Update interval is invalid.\");\n                }\n\n                if (recordInterval <= 0f)\n                {\n                    throw new GameFrameworkException(\"Record interval is invalid.\");\n                }\n\n                m_DownloadCounterNodes = new GameFrameworkLinkedList<DownloadCounterNode>();\n                m_UpdateInterval = updateInterval;\n                m_RecordInterval = recordInterval;\n                Reset();\n            }\n\n            public float UpdateInterval\n            {\n                get\n                {\n                    return m_UpdateInterval;","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Download/DownloadManager.DownloadCounter.cs#L7-L43","documentation":"DownloadCounter is the internal throughput counter of DownloadManager; its constructor requires both a positive update interval and record interval. This error means the update interval passed was <= 0, which would make the counter update every frame or never, breaking speed calculations.","triggerScenarios":"Constructing DownloadCounter (or DownloadManager internally) with updateInterval <= 0f, e.g. passing 0, a negative float, or a config value that failed to parse.","commonSituations":"Download manager settings serialized as 0 in a Unity Inspector/scene, config file missing the interval key defaulting to 0, or float parsing returning 0 for a malformed value.","solutions":["Pass a positive updateInterval (e.g. 1f second) when creating DownloadManager/DownloadCounter","Check serialized DownloadManager settings in the scene/asset are not 0","Validate config parsing does not silently default intervals to 0"],"exampleFix":"// before\nm_DownloadManager = new DownloadManager(downloadCount, 0f, recordInterval);\n// after\nm_DownloadManager = new DownloadManager(downloadCount, 1f, recordInterval);","handlingStrategy":"validation","validationCode":"if (updateInterval <= 0f) updateInterval = 1f; // floor before passing to DownloadManager","typeGuard":"bool IsValidInterval(float seconds) => !float.IsNaN(seconds) && seconds > 0f;","tryCatchPattern":"try { m_DownloadManager = new DownloadManager(...); } catch (GameFrameworkException ex) { Log.Error(\"Download manager config invalid: {0}\", ex.Message); }","preventionTips":["Set non-zero defaults in DownloadManager Inspector settings","Floor all parsed config intervals with Math.Max(1f, value)","Reset-to-default on deserialization failure"],"tags":["download","argument-validation","config","unity","gameframework"],"backgroundTag":"invalid-config-value","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}