EllanJiang/GameFramework · error · GameFrameworkException

You must set download manager first.

Error message

You must set download manager first.

What it means

VersionListProcessor.UpdateVersionList throws this when its download manager reference is null, meaning SetDownloadManager was never called (or was called with a value that failed its own null check). The updater must schedule a download of the new version list, so a download manager is mandatory.

Solutions

  1. Call ResourceManager.SetDownloadManager(downloadManager) during bootstrap, before any version-list update can occur.
  2. Check your init sequence: SetResourceHelper -> SetDownloadManager -> check versions -> update.
  3. Verify SetDownloadManager succeeded (no earlier exceptions) and targets the same ResourceManager instance.

Example fix

// before
// UpdateVersionList called after CheckVersionList(NeedUpdate) but download manager never set
// after (bootstrap)
m_ResourceManager.SetDownloadManager(GameEntry.GetComponent<DownloadManager>());
// then CheckVersionList / UpdateVersionList flow is safe
Defensive patterns

Strategy: try-catch

Validate before calling

// C#
// bootstrap, before any update flow can run:
m_ResourceManager.SetDownloadManager(GameEntry.GetComponent<DownloadManager>());

Try / catch

// C#
try
{
    m_ResourceManager.UpdateVersionList(length, hashCode, compressedLength, compressedHashCode);
}
catch (GameFrameworkException ex) when (ex.Message.Contains("set download manager"))
{
    // initialization bug: wire SetDownloadManager in bootstrap, then retry
}

Prevention

When it happens

Trigger: Calling UpdateVersionList after the check-versions server response indicates an update is needed, but the game never wired the download manager into the resource system.

Common situations: Partial initialization: version checking wired up but download manager setup skipped or failed; SetDownloadManager called on a different processor instance; exception during earlier setup swallowed, leaving m_DownloadManager null.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.VersionListProcessor.cs:139

                {
                    return CheckVersionListResult.NeedUpdate;
                }

                return CheckVersionListResult.Updated;
            }

            /// <summary>
            /// 更新版本资源列表。
            /// </summary>
            /// <param name="versionListLength">版本资源列表大小。</param>
            /// <param name="versionListHashCode">版本资源列表哈希值。</param>
            /// <param name="versionListCompressedLength">版本资源列表压缩后大小。</param>
            /// <param name="versionListCompressedHashCode">版本资源列表压缩后哈希值。</param>
            public void UpdateVersionList(int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode)
            {
                if (m_DownloadManager == null)
                {
                    throw new GameFrameworkException("You must set download manager first.");
                }

                m_VersionListLength = versionListLength;
                m_VersionListHashCode = versionListHashCode;
                m_VersionListCompressedLength = versionListCompressedLength;
                m_VersionListCompressedHashCode = versionListCompressedHashCode;
                string localVersionListFilePath = Utility.Path.GetRegularPath(Path.Combine(m_ResourceManager.m_ReadWritePath, RemoteVersionListFileName));
                int dotPosition = RemoteVersionListFileName.LastIndexOf('.');
                string latestVersionListFullNameWithCrc32 = Utility.Text.Format("{0}.{2:x8}.{1}", RemoteVersionListFileName.Substring(0, dotPosition), RemoteVersionListFileName.Substring(dotPosition + 1), m_VersionListHashCode);
                m_DownloadManager.AddDownload(localVersionListFilePath, Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_UpdatePrefixUri, latestVersionListFullNameWithCrc32)), this);
            }

            private void OnDownloadSuccess(object sender, DownloadSuccessEventArgs e)
            {
                VersionListProcessor versionListProcessor = e.UserData as VersionListProcessor;
                if (versionListProcessor == null || versionListProcessor != this)
                {
                    return;

View on GitHub (pinned to d0c010b051)