EllanJiang/GameFramework · error · GameFrameworkException

Dependency assets is invalid.

Error message

Dependency assets is invalid.

What it means

Static AssetObject.Create validates that the dependencyAssets list argument is non-null before creating an asset object. A null list cannot represent 'no dependencies' — callers must pass an empty list instead. This is a fail-fast argument guard inside ResourceManager's resource loader.

Solutions

  1. Pass a non-null (possibly empty) List<object> for dependencyAssets.
  2. Fix your wrapper so it converts null to new List<object>() before calling the API.
  3. If dependencies are computed dynamically, initialize the list before any early-return path.

Example fix

// before
m_ResourceManager.LoadAsset(assetName, typeof(GameObject), onLoad, null); // null dependency list
// after
m_ResourceManager.LoadAsset(assetName, typeof(GameObject), onLoad, new List<object>());
Defensive patterns

Strategy: validation

Validate before calling

if (dependencyAssets == null) dependencyAssets = new List<object>();

Type guard

bool HasDependencyList(List<object> deps) => deps != null;

Prevention

When it happens

Trigger: Calling ResourceManager.LoadAsset (or ResourceLoader.LoadAsset) with dependencyAssets == null, or custom loader code calling AssetObject.Create directly with a null list.

Common situations: Custom load pipelines that compute dependency lists conditionally and assign null when none exist instead of an empty List<object>; wrappers around LoadAsset forwarding a null parameter.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceLoader.AssetObject.cs:49

                    m_ResourceHelper = null;
                    m_ResourceLoader = null;
                }

                public override bool CustomCanReleaseFlag
                {
                    get
                    {
                        int targetReferenceCount = 0;
                        m_ResourceLoader.m_AssetDependencyCount.TryGetValue(Target, out targetReferenceCount);
                        return base.CustomCanReleaseFlag && targetReferenceCount <= 0;
                    }
                }

                public static AssetObject Create(string name, object target, List<object> dependencyAssets, object resource, IResourceHelper resourceHelper, ResourceLoader resourceLoader)
                {
                    if (dependencyAssets == null)
                    {
                        throw new GameFrameworkException("Dependency assets is invalid.");
                    }

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

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

                    if (resourceLoader == null)
                    {
                        throw new GameFrameworkException("Resource loader is invalid.");
                    }

                    AssetObject assetObject = ReferencePool.Acquire<AssetObject>();

View on GitHub (pinned to d0c010b051)