EllanJiang/GameFramework · critical · GameFrameworkException

Resource helper is invalid.

Error message

Resource helper is invalid.

What it means

GameFramework's ResourceChecker.CheckResources starts the resource-check pipeline by loading the remote and local version lists through the ResourceManager's configured IResourceHelper. If m_ResourceHelper is null, no helper has been registered on the resource manager, so the framework cannot load anything and throws this GameFrameworkException immediately.

Solutions

  1. Add the ResourceHelper component (DefaultResourceHelper) to the GameFramework scene and ensure it registers itself with the ResourceComponent.
  2. Call resourceComponent.SetResourceHelper(new DefaultResourceHelper()) (or your custom IResourceHelper) before CheckResources.
  3. Check the order of your startup code so the helper is assigned before any resource update/check call.

Example fix

// before
m_ResourceComponent.CheckResources(); // helper never set -> throws

// after
m_ResourceComponent.SetResourceHelper(new DefaultResourceHelper());
m_ResourceComponent.CheckResources();
Defensive patterns

Strategy: type-guard

Validate before calling

if (m_ResourceComponent == null)
    throw new InvalidOperationException("ResourceComponent missing");
// ensure helper registered before check
m_ResourceComponent.SetResourceHelper(new DefaultResourceHelper());

Type guard

bool IsResourceHelperReady(ResourceComponent c) =>
    c != null && c.GetComponent<DefaultResourceHelper>() != null;

Try / catch

try { m_ResourceComponent.CheckResources(); }
catch (GameFrameworkException ex) when (ex.Message == "Resource helper is invalid.")
{
    Debug.LogError("ResourceHelper not configured; add it to the GameFramework scene.");
}

Prevention

When it happens

Trigger: Calling CheckResources (e.g. via resourceComponent.CheckResources or UpdateResourceAsync) before the ResourceHelper component has been set on the ResourceManager, or after calling SetResourceHelper was never invoked / was passed a null helper.

Common situations: Forgetting to add the ResourceHelper component in the Unity GameFramework scene hierarchy; calling resource initialization too early in a custom bootstrap before GameFrameworkComponent initialization; a custom helper assignment that accidentally assigns null.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceChecker.cs:68

            /// <summary>
            /// 关闭并清理资源检查器。
            /// </summary>
            public void Shutdown()
            {
                m_CheckInfos.Clear();
            }

            /// <summary>
            /// 检查资源。
            /// </summary>
            /// <param name="currentVariant">当前使用的变体。</param>
            /// <param name="ignoreOtherVariant">是否忽略处理其它变体的资源,若不忽略,将会移除其它变体的资源。</param>
            public void CheckResources(string currentVariant, bool ignoreOtherVariant)
            {
                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.");
                }

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

                m_CurrentVariant = currentVariant;
                m_IgnoreOtherVariant = ignoreOtherVariant;
                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, RemoteVersionListFileName)), new LoadBytesCallbacks(OnLoadUpdatableVersionListSuccess, OnLoadUpdatableVersionListFailure), null);
                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadOnlyPath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadOnlyVersionListSuccess, OnLoadReadOnlyVersionListFailure), null);
                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadWriteVersionListSuccess, OnLoadReadWriteVersionListFailure), null);
            }

View on GitHub (pinned to d0c010b051)