EllanJiang/GameFramework · critical · GameFrameworkException

Resource helper is invalid.

Error message

Resource helper is invalid.

What it means

ResourceManager.ResourceIniter.InitResources starts the resource initialization pipeline and first verifies the framework's dependencies. It throws GameFrameworkException("Resource helper is invalid.") when m_ResourceManager.m_ResourceHelper is null, because the initialization cannot read the resource package without a resource helper (IResourceHelper).

Solutions

  1. Call ResourceManager.SetResourceHelper(new DefaultResourceHelper()) (or your custom helper) before InitResources.
  2. If using Unity GameFramework components, ensure the BaseComponent/ResourceComponent initialization flow ran completely before triggering initialization.
  3. Check for exceptions/failed instantiation in your custom IResourceHelper creation code.

Example fix

// before
resourceComponent.InitResources(currentVariant); // helper never set
// after
resourceComponent.SetResourceHelper(new DefaultResourceHelper());
resourceComponent.InitResources(currentVariant);
Defensive patterns

Strategy: validation

Validate before calling

if (resourceComponent.ResourceHelper == null)
    resourceComponent.SetResourceHelper(new DefaultResourceHelper());
resourceComponent.InitResources(currentVariant);

Type guard

bool HelperReady(GameFramework.Resource.ResourceManager rm) => rm != null && rm.ResourceHelper != null;

Try / catch

try { resourceComponent.InitResources(variant); } catch (GameFrameworkException ex) { Log.Fatal($"InitResources failed: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling InitResources before ResourceManager's resource helper was set — i.e. SetResourceHelper was never called or the helper failed to be created via the game framework's initializer.

Common situations: Skipping Framework entries: custom bootstrap that bypasses GameFramework's component initialization and calls InitResources directly; a custom resource-helper type that failed to instantiate (exception during creation leaves the helper null); wrong initialization order where InitResources runs before SetResourceHelper.

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/56ede15eff78b6dd. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceIniter.cs:56

            }

            /// <summary>
            /// 关闭并清理资源初始化器。
            /// </summary>
            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)

View on GitHub (pinned to d0c010b051)