EllanJiang/GameFramework · error · GameFrameworkException

Can not find resource group

Error message

Can not find resource group '{0}'.

What it means

This GameFrameworkException (a formatted message) is thrown by ResourceManager.UpdateResources when no resource group matches the supplied resourceGroupName — GetResourceGroup returns null. The named group was never added (AddResourceGroup) or the name is misspelled, so there is nothing to update. It is a lookup-failure guard with the offending group name embedded in the message.

Solutions

  1. Add the resource group with AddResourceGroup(name) before calling UpdateResources.
  2. Verify the group name matches exactly (case and spelling) with the group defined in your resource configuration.
  3. Log or enumerate existing groups (GetResourceGroup / GetAllResourceGroups) to confirm the expected group exists at call time.
  4. Ensure group creation happens earlier in startup than the update call.

Example fix

// before
resourceManager.UpdateResources("SceneGroup", callback); // group never added
// after
resourceManager.AddResourceGroup("SceneGroup", ...);
resourceManager.UpdateResources("SceneGroup", callback);
Defensive patterns

Strategy: validation

Validate before calling

if (resourceManager.GetResourceGroup(groupName) == null)
{
    resourceManager.AddResourceGroup(groupName);
}
resourceManager.UpdateResources(groupName, callback);

Type guard

bool GroupExists(ResourceManager rm, string name) => rm.GetResourceGroup(name) != null;

Try / catch

try { resourceManager.UpdateResources(groupName, callback); }
catch (GameFrameworkException ex) when (ex.Message.StartsWith("Can not find resource group")) { UnityEngine.Debug.LogError($"Unknown resource group: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling UpdateResources("Foo", cb) when group 'Foo' was never created via AddResourceGroup; typo in the group name; groups added only in some configurations/environments; group added after the UpdateResources call.

Common situations: Renaming a resource group in the resource editor but not in code; per-platform group definitions that omit the requested group; calling update before the group list is built at startup.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1322

            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new GameFrameworkException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)
            {
                throw new GameFrameworkException("You can not use UpdateResources without updatable resource mode.");
            }

            if (m_ResourceUpdater == null)
            {
                throw new GameFrameworkException("You can not use UpdateResources at this time.");
            }

            ResourceGroup resourceGroup = (ResourceGroup)GetResourceGroup(resourceGroupName);
            if (resourceGroup == null)
            {
                throw new GameFrameworkException(Utility.Text.Format("Can not find resource group '{0}'.", resourceGroupName));
            }

            m_UpdateResourcesCompleteCallback = updateResourcesCompleteCallback;
            m_ResourceUpdater.UpdateResources(resourceGroup);
        }

        /// <summary>
        /// 停止更新资源。
        /// </summary>
        public void StopUpdateResources()
        {
            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new GameFrameworkException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)
            {

View on GitHub (pinned to d0c010b051)