EllanJiang/GameFramework · critical · GameFrameworkException
Read-only path is invalid.
Error message
Read-only path is invalid.
What it means
Thrown by ResourceManager.ResourceIniter.InitResources when the resource system's read-only path is null or empty. The read-only path is where built-in (packaged) resources and the remote version list live, so initialization cannot proceed without it. The library fails fast before attempting to load the package version list file.
Solutions
- Set the read-only path before initializing: resourceComponent.ReadOnlyPath = Application.dataPath (or the packaged resource directory), then call InitResources.
- Verify the ResourceComponent Inspector fields (Read-Only Path / Read-Write Path) are filled in the scene.
- Check platform-specific bootstrap code that assigns m_ReadOnlyPath actually runs on the current target.
Example fix
// before resourceComponent.InitResources(); // m_ReadOnlyPath never set // after resourceComponent.ReadOnlyPath = System.IO.Path.Combine(Application.streamingAssetsPath, "GameFramework"); resourceComponent.InitResources();
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(resourceComponent.ReadOnlyPath)) throw new InvalidOperationException("Set ReadOnlyPath before InitResources."); Type guard
bool ReadOnlyPathValid => !string.IsNullOrEmpty(resourceComponent.ReadOnlyPath);
Prevention
- Always assign ReadOnlyPath in a bootstrap scene before any InitResources call.
- Add a startup assertion logging both ReadOnlyPath and ReadWritePath.
- Keep path assignment platform-specific code in one place to avoid skipped branches.
When it happens
Trigger: Calling ResourceManager.InitResources (via ResourceComponent) before m_ReadOnlyPath has been set, or after it was set to string.Empty.
Common situations: Forgot to set the read-only path in the Unity ResourceComponent inspector; a build script cleared the path; running on a platform where Application.persistentDataPath/streamingAssets setup code was skipped.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- Read-only path is invalid.
- Read-write path is invalid.
- Object pool manager is invalid.
- File system manager is invalid.
- You must set decrypt resource callback before add load…
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/aa97582ed5561544.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.ResourceIniter.cs:61
public void Shutdown()
{
}
/// <summary>
/// 初始化资源。
/// </summary>
public void InitResources(string currentVariant)
{
m_CurrentVariant = currentVariant;
if (m_ResourceManager.m_ResourceHelper == null)
{
throw new GameFrameworkException("Resource helper is invalid.");
}
if (string.IsNullOrEmpty(m_ResourceManager.m_ReadOnlyPath))
{
throw new GameFrameworkException("Read-only path is invalid.");
}
m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadOnlyPath, RemoteVersionListFileName)), new LoadBytesCallbacks(OnLoadPackageVersionListSuccess, OnLoadPackageVersionListFailure), null);
}
private void OnLoadPackageVersionListSuccess(string fileUri, byte[] bytes, float duration, object userData)
{
MemoryStream memoryStream = null;
try
{
memoryStream = new MemoryStream(bytes, false);
PackageVersionList versionList = m_ResourceManager.m_PackageVersionListSerializer.Deserialize(memoryStream);
if (!versionList.IsValid)
{
throw new GameFrameworkException("Deserialize package version list failure.");
}
PackageVersionList.Asset[] assets = versionList.GetAssets();View on GitHub (pinned to d0c010b051)