EllanJiang/GameFramework · error · GameFrameworkException

Resource helper is invalid.

Error message

Resource helper is invalid.

What it means

ResourceVerifier.VerifyResources throws this when the ResourceManager's resource helper has not been set (m_ResourceHelper is null). The verifier needs the helper's LoadBytes method to load the local version list, so verification cannot proceed without it.

Solutions

  1. Call ResourceManager.SetResourceHelper(new DefaultResourceHelper()) (or your custom helper) before VerifyResources.
  2. Verify initialization order: helper setup must precede the verify call in your startup sequence.
  3. Ensure the helper is set on the same ResourceManager instance used for verification.

Example fix

// before
m_ResourceManager.VerifyResources(1024 * 1024); // helper not set yet
// after
m_ResourceManager.SetResourceHelper(new DefaultResourceHelper());
m_ResourceManager.VerifyResources(1024 * 1024);
Defensive patterns

Strategy: validation

Validate before calling

// C#
// ensure helper is registered before verifying
m_ResourceManager.SetResourceHelper(new DefaultResourceHelper()); // once, at bootstrap
// then
m_ResourceManager.VerifyResources(1024 * 1024);

Try / catch

// C#
try
{
    m_ResourceManager.VerifyResources(1024 * 1024);
}
catch (GameFrameworkException ex) when (ex.Message.Contains("Resource helper is invalid"))
{
    // fix init order: call SetResourceHelper, then retry verification
}

Prevention

When it happens

Trigger: Calling VerifyResources before ResourceManager.SetResourceHelper was called, or after it was called with a null/never-assigned helper.

Common situations: Initialization order bugs: verification kicked off in Awake/Start before the helper assignment line runs; helper assignment accidentally removed during refactoring; helper set on a different ResourceManager instance than the one verified.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceVerifier.cs:135

                m_VerifyResourceLengthPerFrame = 0;
                m_VerifyResourceIndex = 0;
                m_FailureFlag = false;
            }

            /// <summary>
            /// 校验资源。
            /// </summary>
            /// <param name="verifyResourceLengthPerFrame">每帧至少校验资源的大小,以字节为单位。</param>
            public void VerifyResources(int verifyResourceLengthPerFrame)
            {
                if (verifyResourceLengthPerFrame < 0)
                {
                    throw new GameFrameworkException("Verify resource count per frame is invalid.");
                }

                if (m_ResourceManager.m_ResourceHelper == null)
                {
                    throw new GameFrameworkException("Resource helper is invalid.");
                }

                if (string.IsNullOrEmpty(m_ResourceManager.m_ReadWritePath))
                {
                    throw new GameFrameworkException("Read-write path is invalid.");
                }

                m_VerifyResourceLengthPerFrame = verifyResourceLengthPerFrame;
                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadWriteVersionListSuccess, OnLoadReadWriteVersionListFailure), null);
            }

            private bool VerifyResource(VerifyInfo verifyInfo)
            {
                if (verifyInfo.UseFileSystem)
                {
                    IFileSystem fileSystem = m_ResourceManager.GetFileSystem(verifyInfo.FileSystemName, false);
                    string fileName = verifyInfo.ResourceName.FullName;
                    FileSystem.FileInfo fileInfo = fileSystem.GetFileInfo(fileName);

View on GitHub (pinned to d0c010b051)