EllanJiang/GameFramework · error · GameFrameworkException
Download manager is invalid.
Error message
Download manager is invalid.
What it means
VersionListProcessor.SetDownloadManager throws this when the downloadManager argument is null. The processor subscribes to the manager's DownloadSuccess/DownloadFailure events to drive version-list updates, so a null manager would break its whole dependency wiring.
Solutions
- Create and initialize the DownloadManager before calling SetDownloadManager.
- Ensure the object passed implements IDownloadManager and is non-null (check your GetComponent/dependency lookup).
- Reorder bootstrap so DownloadManager setup precedes VersionListProcessor setup.
Example fix
// before
m_ResourceManager.SetDownloadManager(m_DownloadManager); // null: not yet created
// after
m_DownloadManager = GameEntry.GetComponent<DownloadManager>();
if (m_DownloadManager != null)
{
m_ResourceManager.SetDownloadManager(m_DownloadManager);
} Defensive patterns
Strategy: type-guard
Validate before calling
// C#
IDownloadManager dm = GameEntry.GetComponent<DownloadManager>();
if (dm == null)
{
throw new InvalidOperationException("DownloadManager not initialized before SetDownloadManager");
}
m_ResourceManager.SetDownloadManager(dm); Type guard
// C# bool IsValidDownloadManager(IDownloadManager dm) => dm != null;
Prevention
- Initialize the DownloadManager component before wiring it into the resource system.
- Null-check dependency lookups instead of passing results straight through.
- Keep a single ordered bootstrap method: helpers, then download manager, then version processing.
When it happens
Trigger: Passing null (or an uninitialized IDownloadManager field) to SetDownloadManager during resource-system setup.
Common situations: Initialization order issues where the DownloadManager component hasn't been created/obtained yet; a null return from a service locator/framework GetComponent call being passed straight through.
Related errors
- You must set download manager first.
- Resource manager is invalid.
- Data provider helper is invalid.
- Owner is invalid.
- Resource manager is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/ae3fb85572f22fe8.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.VersionListProcessor.cs:68
/// </summary>
public void Shutdown()
{
if (m_DownloadManager != null)
{
m_DownloadManager.DownloadSuccess -= OnDownloadSuccess;
m_DownloadManager.DownloadFailure -= OnDownloadFailure;
}
}
/// <summary>
/// 设置下载管理器。
/// </summary>
/// <param name="downloadManager">下载管理器。</param>
public void SetDownloadManager(IDownloadManager downloadManager)
{
if (downloadManager == null)
{
throw new GameFrameworkException("Download manager is invalid.");
}
m_DownloadManager = downloadManager;
m_DownloadManager.DownloadSuccess += OnDownloadSuccess;
m_DownloadManager.DownloadFailure += OnDownloadFailure;
}
/// <summary>
/// 检查版本资源列表。
/// </summary>
/// <param name="latestInternalResourceVersion">最新的内部资源版本号。</param>
/// <returns>检查版本资源列表结果。</returns>
public CheckVersionListResult CheckVersionList(int latestInternalResourceVersion)
{
if (string.IsNullOrEmpty(m_ResourceManager.m_ReadWritePath))
{
throw new GameFrameworkException("Read-write path is invalid.");
}View on GitHub (pinned to d0c010b051)