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
- Call resourceComponent.SetDownloadManager(downloadComponent) during startup before any UpdateResources call.
- Verify the download manager component is added/enabled in the scene or created in code before the update step.
- 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
- Call SetDownloadManager at a single bootstrap point before any update API
- Enforce an init order: create components -> SetDownloadManager -> CheckResources -> update
- Add an assert/log line confirming download manager is set before entering update flow
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
- You must set resource manager first.
- You must set entity helper first.
- Resource helper is invalid.
- You must set download manager first.
- You can not use VerifyResourcePack at this time.
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)