EllanJiang/GameFramework · error · GameFrameworkException

You can not use StopUpdateResources at this time.

Error message

You can not use StopUpdateResources at this time.

What it means

StopUpdateResources() delegates to m_ResourceUpdater, which is created only while a resource update is actually in progress. If the updater instance is null, there is no ongoing update to stop, so ResourceManager throws this GameFrameworkException. It protects the internal invariant that a running updater exists before StopUpdateResources is forwarded to it.

Solutions

  1. Track update state yourself and only call StopUpdateResources while UpdateResourceAsync is in flight (before the update-complete callback fires).
  2. Listen for UpdateResourcesComplete/UpdateResourcesFailure events and mark the update as finished so stop is never called afterwards.
  3. Catch the GameFrameworkException and treat it as 'no update running' if you cannot synchronize state.

Example fix

// before
resourceManager.StopUpdateResources(); // may throw if no update running
// after
if (m_IsUpdatingResources)
{
    resourceManager.StopUpdateResources();
    m_IsUpdatingResources = false;
}
Defensive patterns

Strategy: validation

Validate before calling

if (!m_IsUpdatingResources) return; // only stop during a live update

Try / catch

try { rm.StopUpdateResources(); } catch (GameFrameworkException) { /* update already finished; ignore */ }

Prevention

When it happens

Trigger: Calling StopUpdateResources() when no resource update is running (m_ResourceUpdater == null): e.g. calling it before UpdateResourceAsync, after the update already completed (updater released), or after the update failed and was cleaned up.

Common situations: Calling StopUpdateResources from a UI cancel button even when the update already finished; race between the UpdateResourcesComplete callback and a user-cancel action; calling stop twice.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1346

        /// <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)
        {
            if (string.IsNullOrEmpty(resourcePackPath))
            {
                throw new GameFrameworkException("Resource pack path is invalid.");
            }

View on GitHub (pinned to d0c010b051)