EllanJiang/GameFramework · error · GameFrameworkException
Resource pack path is invalid.
Error message
Resource pack path is invalid.
What it means
Thrown by ResourceManager.ApplyResources when the resourcePackPath argument is null or an empty string. ApplyResources needs a concrete filesystem path to the resource pack to apply, so an empty path is rejected before any file access.
Solutions
- Validate and set the resource pack path before calling ApplyResources.
- Ensure the download/step that produces the pack path succeeded first.
- Catch GameFrameworkException and surface the misconfiguration.
Example fix
// before
m_ResourceManager.ApplyResources(packPath, OnApplyComplete); // packPath == ""
// after
if (!string.IsNullOrEmpty(packPath)) {
m_ResourceManager.ApplyResources(packPath, OnApplyComplete);
} Defensive patterns
Strategy: validation
Validate before calling
if (!m_ResourceInitCompleted) {
Log.Error("CheckResources called before initialization completed");
return;
}
m_ResourceManager.CheckResources(ignoreOtherVariant, cb); Try / catch
try { m_ResourceManager.CheckResources(ignore, cb); } catch (GameFrameworkException ex) { RestartResourceInitialization(); } Prevention
- Run the update flow only after the full initialization state machine completes.
- Handle init failures by restarting initialization instead of proceeding.
- Track init state explicitly and assert before update steps.
When it happens
Trigger: Calling ApplyResources(string, ApplyResourcesCompleteCallback) with null or "", e.g. from config that failed to supply the pack path or a variable that was never set after a download step.
Common situations: Resource pack download step failed silently leaving path empty; config field missing; path built from a formatting bug producing an empty string.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Check resources complete callback is invalid.
- Delta length is invalid.
- Directory name is invalid.
- Length is invalid.
- Offset is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/41e090b3e6e037d1.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.cs:1251
{
throw new GameFrameworkException("You can not use CheckResources at this time.");
}
m_RefuseSetFlag = true;
m_CheckResourcesCompleteCallback = checkResourcesCompleteCallback;
m_ResourceChecker.CheckResources(m_CurrentVariant, ignoreOtherVariant);
}
/// <summary>
/// 使用可更新模式并应用资源包资源。
/// </summary>
/// <param name="resourcePackPath">要应用的资源包路径。</param>
/// <param name="applyResourcesCompleteCallback">使用可更新模式并应用资源包资源完成时的回调函数。</param>
public void ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback)
{
if (string.IsNullOrEmpty(resourcePackPath))
{
throw new GameFrameworkException("Resource pack path is invalid.");
}
if (!File.Exists(resourcePackPath))
{
throw new GameFrameworkException(Utility.Text.Format("Resource pack '{0}' is not exist.", resourcePackPath));
}
if (applyResourcesCompleteCallback == null)
{
throw new GameFrameworkException("Apply resources complete callback is invalid.");
}
if (m_ResourceMode == ResourceMode.Unspecified)
{
throw new GameFrameworkException("You must set resource mode first.");
}
if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)View on GitHub (pinned to d0c010b051)