EllanJiang/GameFramework · error · GameFrameworkException

Resource pack ' ' is not exist.

Error message

Resource pack '{0}' is not exist.

What it means

Thrown by ResourceManager.ApplyResources when the given resourcePackPath does not exist on disk (File.Exists returned false). The formatted message includes the offending path so the developer can see which file was expected.

Solutions

  1. Verify File.Exists(packPath) before calling ApplyResources; if missing, re-download the pack.
  2. Use Application.persistentDataPath-based absolute paths, not relative or hard-coded ones.
  3. Log the exact path in the error to check for casing/format issues.

Example fix

// before
m_ResourceManager.ApplyResources(path, OnApplyComplete);
// after
if (File.Exists(path)) {
    m_ResourceManager.ApplyResources(path, OnApplyComplete);
} else {
    DownloadPackThen(() => m_ResourceManager.ApplyResources(path, OnApplyComplete));
}
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(packPath) || !File.Exists(packPath)) {
    ReDownloadResourcePack();
    return;
}
m_ResourceManager.ApplyResources(packPath, onApplyComplete);

Type guard

bool PackFileExists(string p) => !string.IsNullOrEmpty(p) && File.Exists(p);

Try / catch

try { m_ResourceManager.ApplyResources(packPath, cb); } catch (GameFrameworkException ex) { Log.Error($"Apply failed: {ex.Message}"); ReDownloadResourcePack(); }

Prevention

When it happens

Trigger: Calling ApplyResources with a path to a file that was never downloaded, was deleted between download and apply, uses the wrong filename/casing, or lives in a location the sandbox cannot see (e.g. relative path vs persistentDataPath).

Common situations: Applying a pack before its download completed; app update wiping persistent data; path casing/platform differences (iOS vs Android sandbox paths); hard-coded paths that differ per device.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1256

            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)
            {
                throw new GameFrameworkException("You can not use ApplyResources without updatable resource mode.");
            }

            if (m_ResourceUpdater == null)

View on GitHub (pinned to d0c010b051)