EllanJiang/GameFramework · error · GameFrameworkException

You can not set read-write path at this time.

Error message

You can not set read-write path at this time.

What it means

Thrown by ResourceManager.SetReadWritePath when m_RefuseSetFlag is set, meaning resource initialization has progressed past the point where paths may change (e.g. after CheckResources or on a read-only resource mode). Paths must be configured before the resource component begins initialization.

Solutions

  1. Set the read-write path during startup before initialization completes
  2. Remove redundant late setter calls
  3. Configure via inspector/GameEntry bootstrap before init

Example fix

// before
IEnumerator Start() { yield return Init(); resourceComponent.SetReadWritePath(p); } // refused
// after
void Awake() { resourceComponent.SetReadWritePath(p); }
Defensive patterns

Strategy: validation

Validate before calling

if (!resourceComponent.Initialized) resourceComponent.SetReadWritePath(path); else Log.Warning("Too late to set read-write path");

Try / catch

try { resourceComponent.SetReadWritePath(path); }
catch (GameFrameworkException) { Log.Error("Read-write path must be set before resource initialization completes."); }

Prevention

When it happens

Trigger: Calling SetReadWritePath after ResourceManager initialization has completed and refused further configuration.

Common situations: Setting the path from a delayed callback, coroutine, or second scene load after the framework has initialized the resource component.

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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:890

            }

            m_ReadOnlyPath = readOnlyPath;
        }

        /// <summary>
        /// 设置资源读写区路径。
        /// </summary>
        /// <param name="readWritePath">资源读写区路径。</param>
        public void SetReadWritePath(string readWritePath)
        {
            if (string.IsNullOrEmpty(readWritePath))
            {
                throw new GameFrameworkException("Read-write path is invalid.");
            }

            if (m_RefuseSetFlag)
            {
                throw new GameFrameworkException("You can not set read-write path at this time.");
            }

            if (m_ResourceLoader.TotalAgentCount > 0)
            {
                throw new GameFrameworkException("You must set read-write path before add load resource agent helper.");
            }

            m_ReadWritePath = readWritePath;
        }

        /// <summary>
        /// 设置资源模式。
        /// </summary>
        /// <param name="resourceMode">资源模式。</param>
        public void SetResourceMode(ResourceMode resourceMode)
        {
            if (resourceMode == ResourceMode.Unspecified)
            {

View on GitHub (pinned to d0c010b051)