EllanJiang/GameFramework · error · GameFrameworkException
Read-write path is invalid.
Error message
Read-write path is invalid.
What it means
ResourceManager.SetReadWritePath throws GameFrameworkException when the readWritePath argument is null or empty. The read-write path is where downloaded/updated resources are stored; the framework rejects invalid values immediately.
Solutions
- Pass a valid non-empty path, typically Unity's Application.persistentDataPath or a directory under it
- Fix the config/environment source producing the empty value
- Validate with string.IsNullOrEmpty before calling
Example fix
// before resourceComponent.SetReadWritePath(settings.SavePath); // "" // after resourceComponent.SetReadWritePath(Application.persistentDataPath);
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(readWritePath)) readWritePath = Application.persistentDataPath; resourceComponent.SetReadWritePath(readWritePath);
Type guard
bool IsValidPath(string p) => !string.IsNullOrEmpty(p);
Try / catch
try { resourceComponent.SetReadWritePath(path); }
catch (GameFrameworkException ex) { Log.Error("SetReadWritePath failed: {0}", ex.Message); } Prevention
- Default to Application.persistentDataPath when no explicit path is configured
- Validate paths loaded from config before use
- Test on all target platforms since persistent paths differ
When it happens
Trigger: Calling resourceComponent.SetReadWritePath(null) or resourceComponent.SetReadWritePath("").
Common situations: The path comes from a platform-specific API or config that is empty on the current platform (e.g. missing persistent data path setup), or a typo leaving the setting blank.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Read-only path is invalid.
- Resource mode is invalid.
- Offset is invalid.
- Length is invalid.
- Delta length is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/0f552076871f4486.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.cs:885
}
if (m_ResourceLoader.TotalAgentCount > 0)
{
throw new GameFrameworkException("You must set read-only path before add load resource agent helper.");
}
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>View on GitHub (pinned to d0c010b051)