EllanJiang/GameFramework · error · GameFrameworkException

You must set download manager first.

Error message

You must set download manager first.

What it means

UpdateResources requires a DownloadManager to fetch remote resource files. The ResourceManager throws this guard exception immediately when m_DownloadManager is null, i.e. SetDownloadManager was never called on the resource component before requesting an update.

Solutions

  1. Call resourceComponent.SetDownloadManager(downloadComponent) during startup before any UpdateResources call.
  2. Verify the download manager component is added/enabled in the scene or created in code before the update step.
  3. Gate the update flow behind an init-complete flag that is only set after both CheckResources and SetDownloadManager finished.

Example fix

// before
resourceComponent.UpdateResources(resourceGroup);
// after
resourceComponent.SetDownloadManager(downloadComponent);
resourceComponent.UpdateResources(resourceGroup);
Defensive patterns

Strategy: validation

Validate before calling

if (downloadComponent == null || !m_DownloadManagerSet) { throw new InvalidOperationException("Call SetDownloadManager before UpdateResources"); }
resourceComponent.UpdateResources(resourceGroup);

Type guard

bool DownloadManagerReady => downloadComponent != null && m_DownloadManagerSet;

Try / catch

try { resourceComponent.UpdateResources(group); }
catch (GameFrameworkException ex) when (ex.Message.Contains("download manager"))
{
    Log.Error("Update pipeline not initialized: call SetDownloadManager first");
}

Prevention

When it happens

Trigger: Calling UpdateResources(resourceGroup) before ResourceManager.SetDownloadManager(downloadManager) has been called with an initialized DownloadManager.

Common situations: Initialization order mistakes: the update flow starts before the download component is created/registered, or the download manager setup line was removed or runs conditionally and never executes.

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/7fe82a4c4c43d2f1. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceUpdater.cs:406

                    if (m_ApplyingResourcePackStream != null)
                    {
                        m_ApplyingResourcePackStream.Dispose();
                        m_ApplyingResourcePackStream = null;
                    }

                    throw new GameFrameworkException(Utility.Text.Format("Apply resources '{0}' with exception '{1}'.", resourcePackPath, exception), exception);
                }
            }

            /// <summary>
            /// 更新指定资源组的资源。
            /// </summary>
            /// <param name="resourceGroup">要更新的资源组。</param>
            public void UpdateResources(ResourceGroup resourceGroup)
            {
                if (m_DownloadManager == null)
                {
                    throw new GameFrameworkException("You must set download manager first.");
                }

                if (!m_CheckResourcesComplete)
                {
                    throw new GameFrameworkException("You must check resources complete first.");
                }

                if (m_ApplyingResourcePackStream != null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("There is already a resource pack '{0}' being applied.", m_ApplyingResourcePackPath));
                }

                if (m_UpdatingResourceGroup != null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("There is already a resource group '{0}' being updated.", m_UpdatingResourceGroup.Name));
                }

                if (string.IsNullOrEmpty(resourceGroup.Name))

View on GitHub (pinned to d0c010b051)