EllanJiang/GameFramework · error · GameFrameworkException

You can not use StopUpdateResources without updatable…

Error message

You can not use StopUpdateResources without updatable resource mode.

What it means

StopUpdateResources() is only meaningful when the game runs in an updatable resource mode (Updatable or UpdatableWhilePlaying). ResourceManager throws this GameFrameworkException during the pre-checks of StopUpdateResources when the current m_ResourceMode is not one of those two modes, because there is nothing updatable to stop. It is a guard against calling a feature that the current resource configuration does not support.

Solutions

  1. Set the resource mode to ResourceMode.Updatable or ResourceMode.UpdatableWhilePlaying before calling StopUpdateResources.
  2. Only call StopUpdateResources after UpdateResourceAsync has actually started updating in an updatable mode.
  3. Wrap the call in a mode check: if (resourceManager.ResourceMode == ResourceMode.Updatable || resourceManager.ResourceMode == ResourceMode.UpdatableWhilePlaying) { ... }

Example fix

// before
resourceManager.StopUpdateResources(); // throws in Package mode
// after
if (resourceManager.ResourceMode == ResourceMode.Updatable || resourceManager.ResourceMode == ResourceMode.UpdatableWhilePlaying)
{
    resourceManager.StopUpdateResources();
}
Defensive patterns

Strategy: validation

Validate before calling

bool canStop = rm.ResourceMode == ResourceMode.Updatable || rm.ResourceMode == ResourceMode.UpdatableWhilePlaying;
if (!canStop) return;

Type guard

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

Try / catch

try { rm.StopUpdateResources(); } catch (GameFrameworkException ex) { Log.Warn("Cannot stop update: " + ex.Message); }

Prevention

When it happens

Trigger: Calling ResourceManager.StopUpdateResources() while m_ResourceMode is ResourceMode.Unspecified or ResourceMode.Package (i.e. resource mode was never set or set to package-only mode before/instead of calling UpdateResourceAsync).

Common situations: Developers switch a demo from Package mode to a shipping updatable build but leave the StopUpdateResources call in a cleanup path; or they call StopUpdateResources before InitializeResourceMode/setting the mode, hitting the mode check first.

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/b551f1e9b3dae976. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1341

            }

            m_UpdateResourcesCompleteCallback = updateResourcesCompleteCallback;
            m_ResourceUpdater.UpdateResources(resourceGroup);
        }

        /// <summary>
        /// 停止更新资源。
        /// </summary>
        public void StopUpdateResources()
        {
            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 StopUpdateResources without updatable resource mode.");
            }

            if (m_ResourceUpdater == null)
            {
                throw new GameFrameworkException("You can not use StopUpdateResources at this time.");
            }

            m_ResourceUpdater.StopUpdateResources();
            m_UpdateResourcesCompleteCallback = null;
        }

        /// <summary>
        /// 校验资源包。
        /// </summary>
        /// <param name="resourcePackPath">要校验的资源包路径。</param>
        /// <returns>是否校验资源包成功。</returns>
        public bool VerifyResourcePack(string resourcePackPath)
        {

View on GitHub (pinned to d0c010b051)