EllanJiang/GameFramework · error · GameFrameworkException

You can not use ApplyResources without updatable resource…

Error message

You can not use ApplyResources without updatable resource mode.

What it means

This GameFrameworkException is thrown by ResourceManager.ApplyResources when the configured ResourceMode is neither Updatable nor UpdatableWhilePlaying (e.g. Package mode). Applying a downloaded resource pack only makes sense when resources are updatable, so the API rejects the call in fixed-package mode. It is a mode-compatibility guard.

Solutions

  1. Set ResourceMode to Updatable or UpdatableWhilePlaying when the game needs ApplyResources.
  2. Guard the ApplyResources call with a check of ResourceManager.ResourceMode before invoking it.
  3. Remove or branch off the ApplyResources call for Package-mode builds.

Example fix

// before
resourceManager.ApplyResources(packPath, callback);
// after
if (resourceManager.ResourceMode == ResourceMode.Updatable || resourceManager.ResourceMode == ResourceMode.UpdatableWhilePlaying)
{
    resourceManager.ApplyResources(packPath, callback);
}
Defensive patterns

Strategy: validation

Validate before calling

var mode = resourceManager.ResourceMode;
if (mode != ResourceMode.Updatable && mode != ResourceMode.UpdatableWhilePlaying) return; // skip apply in non-updatable modes

Type guard

bool IsUpdatableMode(ResourceMode m) => m == ResourceMode.Updatable || m == ResourceMode.UpdatableWhilePlaying;

Try / catch

try { resourceManager.ApplyResources(packPath, callback); }
catch (GameFrameworkException ex) when (ex.Message.Contains("updatable resource mode")) { UnityEngine.Debug.LogWarning("ApplyResources not available in this resource mode."); }

Prevention

When it happens

Trigger: Calling ApplyResources while m_ResourceMode is ResourceMode.Package or ResourceMode.Unspecified; an app configured for non-updatable mode invoking pack-apply logic (e.g. after a config that disables hot-update).

Common situations: Build configuration mistakenly set to Package mode in an app that also performs hot updates; shared code paths that call ApplyResources regardless of the selected mode; QA toggles switching resource mode without guarding call sites.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1271

            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)
            {
                throw new GameFrameworkException("You can not use ApplyResources at this time.");
            }

            m_ApplyResourcesCompleteCallback = applyResourcesCompleteCallback;
            m_ResourceUpdater.ApplyResources(resourcePackPath);
        }

        /// <summary>
        /// 使用可更新模式并更新所有资源。
        /// </summary>
        /// <param name="updateResourcesCompleteCallback">使用可更新模式并更新默认资源组完成时的回调函数。</param>
        public void UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback)
        {
            UpdateResources(string.Empty, updateResourcesCompleteCallback);

View on GitHub (pinned to d0c010b051)